-
-
Notifications
You must be signed in to change notification settings - Fork 740
Adding arity traits #643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding arity traits #643
Conversation
Imho, the way variadic parameters are handled (i.e. ignored) should be documented, and the description should refer to »parameters« instead of »arguments«. Also consider leaving off the type of the constant (it should probably be Anyway, I'm not quite sure whether an isolated addition like this makes much sense. I could imagine that such a template would fit well into a set of other callable type handlers/manipulators, but as it is now, I don't see much benefit over |
This patch is motivated by the following discussion on the forum. @andralex suggested to add small pull requests and proposed to start with arity. Yes there is no real benefit over Also
We can debate about whether this should be a coherent proposal or just some piecemeal additions. |
@klickverbot: uint is better than size_t because the latter measures sizes of objects in memory whereas uint is a better fit as a "natural number". |
Probably variadic functions should have uint.max as arity, or not define arity at all. I'd prefer the latter. |
@andralex: |
Which one of the following is recommended for the variadic function unittest ?
|
You can go with either:
Some people prefer one, some the other. |
@andralex I actually would have argued |
Alright size_t it is. @gchatelet could you please make the change so I can pull. Thanks! |
@andralex : done ! |
First minimal addition to std.traits.
Adding an arity template returning the number of argument of a function.
Maybe it should go to std.functional instead ?