1.0 ?? [templates and currying]
Daniel Keep
daniel.keep.lists at gmail.com
Mon Nov 6 19:24:17 PST 2006
Walter Bright wrote:
> ...
>
> I'm writing an std.traits module, which will abstract away that stuff.
> So, if you're willing to rewrite using std.traits.Returns and std.traits
> ..Parameters, you'll be immunized against changes in the future.
>
Well, I originally wrote the code because I was playing with embedding
Python in D, and needed a way to get that information about a function.
However, Kirk beat me to the punch, so I haven't used it since.
So, yes. I'd be happy to use the "proper" traits library :)
Any idea what else will be going in std.traits? I've already got a
small traits library that I use in a few places that does things like
convert between signed and unsigned types, find the next largest integer
type, work out if a type is an integer or float, etc. I can post the
code if you're looking for ideas.
> Also, to get number of parameters for function foo:
>
> Parameters!(foo).length
>
> will do it. First parameter type is:
>
> Parameters!(foo)[0]
>
> Rest of the parameter types are:
>
> Parameters!(foo)[1 .. length]
>
> Etc.
Very cool. I likes :)
-- Daniel
--
Unlike Knuth, I have neither proven or tried the above; it may not even
make sense.
v2sw5+8Yhw5ln4+5pr6OFPma8u6+7Lw4Tm6+7l6+7D
i28a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP http://hackerkey.com/
More information about the Digitalmars-d
mailing list