What does __parameters return?

H. S. Teoh hsteoh at quickfur.ath.cx
Thu Sep 12 14:06:05 PDT 2013


On Thu, Sep 12, 2013 at 10:40:06PM +0200, simendsjo wrote:
> On Thursday, 12 September 2013 at 19:41:26 UTC, H. S. Teoh wrote:
> >On Thu, Sep 12, 2013 at 08:44:29PM +0200, simendsjo wrote:
> (...)
> >>.. but what type is it?
> >>
> >>Error: argument (int i, char c, string s, bool b = false) to typeof
> >>is not an expression
> >>
> >>How am I supposed to get the parameter names using this?
> >>
> (...)
> >
> >You're not going to like the answer to this one... :)
> >
> (...)
> >
> >Or just parse the string returned by the .stringof value, as you
> >suggested.
> >
> 
> Thanks. I just ended up using both is(__parameters and is(function
> to fetch the parameter names. Sometimes it seems things are added to
> D without a very thorough design phase, but then again, it starts
> with "__", so I guess I'm on my own :)

I think Walter's official statement on the matter is that __traits is
not intended to be used by user code, but to allow Phobos to access
compiler internals so that it can provide more user-friendly wrappers
around the raw functionality.


T

-- 
Nobody is perfect.  I am Nobody. -- pepoluan, GKC forum


More information about the Digitalmars-d-learn mailing list