Consistency, Templates, Constructors, and D3
Era Scarecrow
rtcvb32 at yahoo.com
Mon Aug 27 06:50:16 PDT 2012
On Monday, 27 August 2012 at 12:51:48 UTC, F i L wrote:
> auto a = Point(int)[].new(5).new(1, 2);
>
> but then, I can see why someone would want the distinction so
> it's easier to understand what constructor belongs to the Array.
>
> Either way, I don't see any conflicts with the syntax I
> purposed.
Except being somewhat unfamiliar with it, I can only look it
over and go 'huh? what's going on?'.
new being a keyword from C++ for allocate on the heap
immediately makes this whole thing confusing. I would wonder
myself: Is this on the stack or in the heap for the whole thing?
Is Point a struct or a class? Then I wonder assuming that you get
5 for the length, then would all the elements be set the same or
just the first one?
Would new still be a key word? If not (and uses a regular
function signature as you propose), then what if someone decided
to use new for something other than allocation and returned
something other than the type you were expecting from the view
above? (Say, making a 2d matrix?)
Sorry, there are just coming forward for me as I sit here
reading it.
More information about the Digitalmars-d
mailing list