digitalmars.D - Inadequacies of __traits
- Kirk McDonald (10/10) Jul 27 2007 I started writing this as a newsgroup post, but decided I'd rather make
- BCS (5/13) Jul 27 2007 I'd post this as a comment but, I don't have a Google account.
- Kirk McDonald (10/29) Jul 27 2007 The primary issue I have with with _ctor is that you cannot use it to
- BCS (5/11) Jul 27 2007 I'm basically with you on this. _ctor is to different than the rest to b...
- Jarrett Billingsley (13/18) Jul 27 2007 Doesn't really help your problem, but just a bit of info to make the
I started writing this as a newsgroup post, but decided I'd rather make it a blog post: http://kirkmcdonald.blogspot.com/2007/07/inadequacies-of-traits.html __traits is a worthy addition to D, but it needs a couple more features to be truly useful. -- Kirk McDonald http://kirkmcdonald.blogspot.com Pyd: Connecting D and Python http://pyd.dsource.org
Jul 27 2007
Reply to Kirk,I started writing this as a newsgroup post, but decided I'd rather make it a blog post: http://kirkmcdonald.blogspot.com/2007/07/inadequacies-of-traits.html __traits is a worthy addition to D, but it needs a couple more features to be truly useful.I'd post this as a comment but, I don't have a Google account. off the cuff ctor might be usable like this: (cast(Foo)(new byte[Foo.sizeOfObject]).ptr)._ctor(100)
Jul 27 2007
BCS wrote:Reply to Kirk,The primary issue I have with with _ctor is that you cannot use it to get the signatures of all of the class's constructors (just of the lexically first constructor). My second concern is that the isFooFunction traits don't report what kind of function it is correctly. -- Kirk McDonald http://kirkmcdonald.blogspot.com Pyd: Connecting D and Python http://pyd.dsource.orgI started writing this as a newsgroup post, but decided I'd rather make it a blog post: http://kirkmcdonald.blogspot.com/2007/07/inadequacies-of-traits.html __traits is a worthy addition to D, but it needs a couple more features to be truly useful.I'd post this as a comment but, I don't have a Google account. off the cuff ctor might be usable like this: (cast(Foo)(new byte[Foo.sizeOfObject]).ptr)._ctor(100)
Jul 27 2007
Reply to Kirk,The primary issue I have with with _ctor is that you cannot use it to get the signatures of all of the class's constructors (just of the lexically first constructor). My second concern is that the isFooFunction traits don't report what kind of function it is correctly.I'm basically with you on this. _ctor is to different than the rest to be thrown in there. Maybe it needs it's own trait, some sort of __traits(ctorOf, Foo) that gives a tuple of signatures.
Jul 27 2007
"Kirk McDonald" <kirklin.mcdonald gmail.com> wrote in message news:f8drd0$1i92$1 digitalmars.com...I started writing this as a newsgroup post, but decided I'd rather make it a blog post: http://kirkmcdonald.blogspot.com/2007/07/inadequacies-of-traits.html __traits is a worthy addition to D, but it needs a couple more features to be truly useful.Doesn't really help your problem, but just a bit of info to make the constructor issue a little more lucid. The constructor really is just another class method. Class construction works something like (1) allocate the class's memory, either using the default method or using the overloaded 'new', (2) copy the static instance of the class into that memory, and (3) call the _ctor method of the new instance. That's why (1) you can call _ctor as an instance method and (2) it returns 'this', as returning 'this' is why "new Foo()" gives you the instance -- you're really getting the return value of _ctor. But more on topic, hopefully Walter will be receptive to your comments this time too.
Jul 27 2007