transporting qualifier from parameter to the return value

Steven Schveighoffer schveiguy at yahoo.com
Tue Dec 15 20:31:51 PST 2009


On Tue, 15 Dec 2009 23:21:49 -0500, Michel Fortin  
<michel.fortin at michelf.com> wrote:

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

That's a very good point.  My preference would then be to say that it's  
fine to allow not having inout in the return type for the sake of generic  
programming.  Seems similar to allowing returning the result of a void  
function inside a void function.

-Steve



More information about the Digitalmars-d mailing list