Generic programming ramifications of const by default
Georg Wrede
georg at nospam.org
Tue Jun 12 04:01:58 PDT 2007
Reiner Pope wrote:
>
> I agree with what you have written. I've got another similar example:
> the hypothetical DeclareFunction template, to be used as:
>
> alias DeclareFunction!(int, "a", double, "d", "code") myFunction;
> // should be equivalent to
> // void myFunction(int a, double d) { code }
> // no matter if const-by-default or not
(Slightly off-topic, but) shouldn't
alias DeclareFunction!(int, "a", double, "d", "code") myFunction;
mean
int myFunction(double d) { code }
In other words, the return type would be the first parameter to
DeclareFunction!().
If we really wanted to ignore the return type (as in your example), then
we might want another name for the template.
For a lack of a better name, I'd suggest DeclareProcedure, where this
distinction is of course borrowed from Pascal.
Actually there's a "typo" here, my line should of course be
alias DeclareFunction!(int, double, "d", "code") myFunction;
(No use naming the return value. :-) )
More information about the Digitalmars-d
mailing list