equivariant functions
Jason House
jason.james.house at gmail.com
Mon Oct 13 05:42:10 PDT 2008
Andrei Alexandrescu Wrote:
> ore-sama wrote:
> > Andrei Alexandrescu Wrote:
> >
> >> typeof(s) stripl(const(char)[] s);
> >>
> >> This signature states that it returns the same type as an argument. I
> >> propose that that pattern means stripl can accept _any_ subtype of
> >> const(char)[] and return that exact type. Inside the function, however,
> >> the type of s is the type declared, thus restricting its use.
> >
> > this conflicts with current definition of typeof. Currently
> > typeof(s) stripl(const(char)[] s); should be interpreted exactly as
> > const(char)[] stripl(const(char)[] s);
> > it's unclear that typeof here gets type of actual argument rather than parameter. Currently typeof applies to parameter.
>
> That is correct.
>
> Andrei
I've never understood the reuse of keywords for new meanings. I much prefer new keywords for new concepts.
More information about the Digitalmars-d
mailing list