transporting qualifier from parameter to the return value

dsimcha dsimcha at yahoo.com
Tue Dec 15 21:04:26 PST 2009


== Quote from Walter Bright (newshound1 at digitalmars.com)'s article
> Andrei Alexandrescu wrote:
> > Time has come to make a decision on implementing Steven Schveighoffer's
> > proposal:
> Unmentioned in the proposal is is inout a type constructor or a storage
> class? For example,
>      U[inout(T)]* foo(inout(X)*** p) { ... }

I think it's got to be a storage class, or it's only a partial solution.  If your
above example doesn't work, people will still be forced to resort to all kinds of
kludges like using templates and plain old code duplication.

> I also prefer the idea of inout on the return type being assumed, rather
> than explicit:
>      T foo(inout U p) { ... }

Not sure how much sense that would make if we go the full storage class route, for
example in your above example.  It seems like this would be hard to infer.  If we
go the top level only route, then it seems like a worthwhile thing to save some
syntactic noise.




More information about the Digitalmars-d mailing list