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



--- Comment #4 from timon.g...@gmx.ch 2011-11-10 12:57:55 PST ---
(In reply to comment #3)
> From discussion in https://github.com/D-Programming-Language/dmd/pull/505
> 
> 1. inout + const of T should parse [1a] const(T) or [1b] inout(T)?
> 2. or introduce new combined qualifier inout(const(T))? (see bug 6930)
> 
> Current my patch have selected [1a] as the result.


Parsing it as inout(T) or parsing it as const(T) is both wrong (and any of the
two are an arbitrary choice).

The 'definition' of inout is that it is whatever qualifier is on the input
argument.

Consider the type

inout(const(T))

We can now make a case distinction:

1. inout == mutable   => inout(const(T)) == const(T)
2. inout == const     => inout(const(T)) == const(const(T)) == const(T)
3. inout == immutable => inout(const(T)) == immutable(const(T)) == immutable(T)

Option 1. does not support the 3rd case, therefore it is wrong.
Option 2. works as expected, therefore it is correct.

I do not think there is a choice. (adding unnecessary special cases is the way
to make a language ugly and complicated, see C++)

If you disagree, with what part of the explanation do you disagree?

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

Reply via email to