Wow! I'm really lucky as far as finding bizzare language subtelties or compiler 
bugs but... I've actually encountered this behaviour before. I guess I just 
assumed you can use constructor syntax with any type. 

@rayman22201 array is pretty much std::array and seq is pretty much 
std::vector. I think I even read sometime ago that this is how they are 
compiled to C++ backend. Also: the only difference between tuple and object 
without of ... (e.x. of RootObj) is type safety --- a tuple behaves 
structurally (you can assign any compatible tuple to it), contrary to an 
object. It seems to me objects are widely preferred for most usecases.

Be careful when setting fields after you create a type value/instance. While 
tempting, it causes its fields, even the ones you change immediately after 
construction, to be initialized by default values. Which can be quite 
inefficient for large objects, actually. You can use {.noInit.} pragma to omit 
initialization of a variable and then initialize its fields without any 
performance penalty.

Reply via email to