Fixing const arrays
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Sat Dec 10 14:39:27 PST 2011
On 12/10/11 4:31 PM, kenji hara wrote:
> Treating whole constant arrays as ranges by automatically shedding the
> top-level const is good.
> But realizing it by language semantic change is definitely bad.It
> breaks IFTI rule, and adding special case will make difficult to learn
> language.
There is no breakage of IFTI, just a reduction of what IFTI sees.
> Instead of language change, we can add specializations that receive
> non-ranges and convert them to ranges by removing top-level const.
> I believe that it is Phobos issue and is never the issue of language.
The problem here is scale. We're looking at an absolutely massive code
duplication for every single function. I don't think this will ever
work; if we do it in Phobos it will make Phobos and by extension the
language more difficult to understand AND more bloated for the sake of
needless consistency.
The language change is legitimate when you think of it this way - it
gives template functions back the natural right to change their local
state. This right was already there for non-template functions.
Andrei
More information about the Digitalmars-d
mailing list