I recently added view syntax to the spec. It's special though:
let foo:uint64[] = [1];
let bar = uint32[](foo, 0, 2);
This is the only instance of an array constructor. Is this just a limited feature that's acceptable in the language or could it be expanded. I'm worried someone will point it out as being too special.
So when using custom types like:
let foo:MyType[] = [0, 1, 2];
It's already been defined it would call the constructor for each item. Is there a case where we'd want:
let foo = new MyType[10](10);
I'd read it like "construct 10 objects of MyType and construct each object with the parameter 10. Is this too niche?
Also the TypedArray example was an empty array so a better comparison is:
let foo = new MyType[](10);
foo.push(); // Construct an object MyType(10) by default? Seems niche.
Any thoughts on if this line of thought could create actually useful feature or is just pointless?
I recently added view syntax to the spec. It's special though:
This is the only instance of an array constructor. Is this just a limited feature that's acceptable in the language or could it be expanded. I'm worried someone will point it out as being too special.
So when using custom types like:
It's already been defined it would call the constructor for each item. Is there a case where we'd want:
I'd read it like "construct 10 objects of MyType and construct each object with the parameter 10. Is this too niche?
Also the TypedArray example was an empty array so a better comparison is:
Any thoughts on if this line of thought could create actually useful feature or is just pointless?