transporting qualifier from parameter to the return value

Michel Fortin michel.fortin at michelf.com
Tue Dec 15 20:21:49 PST 2009


On 2009-12-15 23:02:36 -0500, "Steven Schveighoffer" 
<schveiguy at yahoo.com> said:

> First, the proposal as I see it is to compile *one* copy of doSomething 
>  (see points 5 and 6 in the DIP description).  Second, inout (or 
> vconst)  implicitly casts to const, so it can call any functions that 
> require const  *or* that require inout.

I see. Well that could work, as long as we don't mix shared with it.


> Third, and this is kind of a nitpick, inout  functions should *require* 
> inout in the return type, otherwise, there's no  point, the qualifier 
> could just be const :)  So your example is  technically invalid.

Should it? I think it'd be better to allow it anyway for generic 
programming... or at least allow inout(void) as the return type.


-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/




More information about the Digitalmars-d mailing list