transporting qualifier from parameter to the return value

Steven Schveighoffer schveiguy at yahoo.com
Sun Dec 20 05:34:41 PST 2009


On Sun, 20 Dec 2009 07:58:06 -0500, Jason House  
<jason.james.house at gmail.com> wrote:

> Steven Schveighoffer Wrote:
>
>> On Sat, 19 Dec 2009 18:35:13 -0500, Jason House
>> <jason.james.house at gmail.com> wrote:
>>
>> > The meaning of inout by a nested function isn't obvious when the
>> > enclosing function is already using inout. Does inout of the nested
>> > function match that of the enclosing function? Or are they distinct.  
>> If
>> > distinct, there may semantically ambiguous cases...
>>
>> One thing that inout does is [snip of very long, but off topic reply :(]
>
> I meant functions nested inside of functions.
>
> inout(A) foo(inout B b, inout C c){
>   inout(D) bar(inout E e, inout F f){ ... }
>   ...
> }

OK, I get what you are saying now, sorry for the off-topic reply.  That  
would pose a confusing prospect.  Since we only have one inout keyword, we  
cannot allow 2 meanings for it.  So either we have to disallow inout  
functions as nested functions, or color the inout portions of the outer  
function as const implicitly while inside the inner function.  I think the  
most useful choice is the latter.  If you want any of the inout variables  
of the outer function to participate in choosing the inout constancy of  
the inner function, then they must be explicitly passed.

Thanks for clarifying, that is an important thing to get right.

-Steve



More information about the Digitalmars-d mailing list