Get constructor for a class

Namespace rswhite4 at googlemail.com
Fri Sep 13 08:27:41 PDT 2013


On Friday, 13 September 2013 at 15:16:36 UTC, H. S. Teoh wrote:
> On Fri, Sep 13, 2013 at 04:16:30PM +0200, simendsjo wrote:
>> On Friday, 13 September 2013 at 14:02:15 UTC, Gary Willoughby 
>> wrote:
> [...]
>> >A lot of the traits stuff is very confusing, i think a lot of 
>> >it
>> >is still being finalised and in development. I'm working on a
>> >project using a lot of traits stuff and it's doing my head 
>> >in. I
>> >wish there was better documentation. e.g. what is 'func' in 
>> >the
>> >code above? i'm using it successfully but i've no idea what 
>> >it is.
>> 
>> I know what you mean. Have been using quite some __traits and 
>> is(),
>> and I still have to look up the syntax for is() all the time, 
>> and
>> experiment with both trying to find the edge-cases.
> [...]
>
> The syntax for is() is one gigantic mess. It does work, but 
> it's not
> pretty. IIRC Walter admitted that it could do with some 
> cleanup, but
> it's a bit too late now since too much code relies on its 
> quirks.
>
> As for __traits, I believe the intention was that it wasn't 
> meant for
> end-user consumption, but for Phobos to be able to access 
> compiler
> internals. As such, it only provides the bare minimum for 
> Phobos to be
> able to work, so there are a lot of quirks and edge cases. I 
> was quite
> dismayed yesterday to discover that "parameter type tuples" are 
> actually
> different from the usual "type tuples", and don't even behave
> consistently with foreach (they masquerade as type tuples w.r.t.
> foreach, and there's weird special-casing for 1-element slices 
> of them,
> e.g. for __traits(identifier...)). I don't know what's the 
> rationale for
> this strange design, but it sure looks like it was just a quick 
> hack to
> make Phobos work rather than anything carefully thought out.
>
> Personally, I would just stick with the Phobos interfaces, and 
> file bugs
> (or pull requests) if the existing interfaces aren't sufficient 
> for your
> needs.
>
>
> T

We should clean up this mess in 'is' and 'traits' and especially 
for tuples. IMO it's ok if it breaks code as long as it helps to 
write cleaner and tough code. This will also help D to gain more 
attention.
There is so many crap in D... We should really start to clean up 
as long as D2 is still a Beta.
And we should stop to transform it into something like C++ with 
transferring built-in features into the library (like scope or 
delete).


More information about the Digitalmars-d-learn mailing list