That's correct.
It could be written as a named instantiation this way:
MessageBox msgBox {type=ok,text="caption",contents="message"};
msgBox.Modal();
Then the first line would be a
declaration (needs to be at the top of the block), and the second line a statement. The all in one line with anonymous declaration is a
statement.
You could also do:
MessageBox msgBox; msgBox = {type=ok,text="caption",contents="message"}; (an inferred type anonymous instantiation as an expression to an assignment)
or
MessageBox msgBox; msgBox = MessageBox {type=ok,text="caption",contents="message"}; (an explicit anonymous instantiation as an expression to an assignment)
or
MessageBox msgBox = {type=ok,text="caption",contents="message"}; (an inferred type anonymous instantiation as an expression to a declaration initializer)
or
MessageBox msgBox = MessageBox {type=ok,text="caption",contents="message"}; (an explicit type anonymous instantiation as an expression to a declaration initializer)
With the exception of the declaration/statement difference (and the syntax errors you may get because eC is strict on declarations before statements), they are pretty much all equivalent.
The only other difference is that the named instantiation (the first one I wrote at the top) would auto increment/decrement the reference count when it applies (at the moment, only as a member instantiation or a global object, later on when eC supports it during the scope of the block).
I'm not sure yet how anonymous instantiation will behave in regards to reference counting in the future
At the moment nothing is done, they have a 0 _refCount.
Regards,
Jerome