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



--- Comment #12 from timon.g...@gmx.ch 2011-11-10 13:33:33 PST ---
(In reply to comment #11)
> (In reply to comment #10)
> > (In reply to comment #9)
> > > inout's primary focus is transferring the type modifier from the 
> > > arguments to
> > > the return type.  Merging it with a possible external immutable type is
> > > secondary.
> > > 
> > > I think inout(const(T)) should resolve as we've discussed.  The 
> > > enhancement is
> > > that immutable(T) and inout(T) should be implicitly castable to
> > > inout(const(T)).  
> > 
> > See specification of inout:
> > http://d-programming-language.org/function.html
> > 
> > "The inout forms a wildcard that stands in for any of mutable, const or
> > immutable. When the function is called, the inout of the return type is 
> > changed
> > to whatever the mutable, const, or immutable status of the argument type to 
> > the
> > parameter inout was."
> > 
> > If inout(const(T)) is parsed as const(T) then the inout does not form a
> > wildcard that can stand for immutable. Contradiction with the language
> > specification. That is a bug.
> 
> You may be misunderstanding me.  I agree this is a bug.  I'll try to be
> clearer:
> 
> 1. inout(const(T)) should resolve to const(T) or immutable(T) upon exit from
> inout scope.  That it resolves to const(T) right now is a bug.
> 
> 2. immutable(T) and inout(T) can legally implicitly cast to inout(const(T)). 
> This is an enhancement.

Hm ok. I believe you are right for a possible interpretation of the language
spec. It states that nothing converts implicitly to inout, that immutable and
inout convert to const but it does not make any mention of what converts to
inout const. Ergo it is contradictory and we are both right.

But 1. is not worth fixing if 2. is not implemented, therefore the bugfix
implies the enhancement. =)

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

Reply via email to