Fixing const arrays
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Sat Dec 10 14:41:18 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.
>
> 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.
I should add there is precedent. C++ also removes top-level const when
passing objects by value to templates. Deducing top-level const with
pass-by-value is inherently nonsensical.
Andrei
More information about the Digitalmars-d
mailing list