[Issue 7543] inout opApply should work properly

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Mar 9 15:42:35 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7543



--- Comment #8 from Stewart Gordon <smjg at iname.com> 2012-03-09 15:42:40 PST ---
I think the claim that the reporter is actually making is that the inout
constancy of the delegate parameter should vary with that of this.  In other
words,

    int opApply(int delegate(ref inout(int)) dg) inout

should be callable as if it's any one of these:

    int opApply(int delegate(ref int) dg)
    int opApply(int delegate(ref const(int)) dg) const
    int opApply(int delegate(ref immutable(int)) dg) immutable

I was trying to do this myself before this issue was filed.

(In reply to comment #6)
> 3.  Aside from all the above, inout already has different semantics 
> inside function bodies, so it would be ambiguous to have another 
> instance of inout in a variable declaration because you can only 
> refer to one constness (that of the args of the current function).

Indeed.  The point is that there are two possible interpretations of the
opApply signature, and the spec isn't clear on which applies:

(a) the constancy is passed through to the delegate
(b) the delegate has an inout parameter in its own right

See the newsgroup thread I've already linked to for a more detailed discussion
of this.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list