D's greatest mistakes

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Nov 29 11:36:10 PST 2010


On 11/29/10 1:09 PM, Steven Schveighoffer wrote:
> On Mon, 29 Nov 2010 13:10:14 -0500, Andrei Alexandrescu
> <SeeWebsiteForEmail at erdani.org> wrote:
>
>> On 11/29/10 10:59 AM, Steven Schveighoffer wrote:
>>> On Mon, 29 Nov 2010 11:19:29 -0500, Andrei Alexandrescu
>>> <SeeWebsiteForEmail at erdani.org> wrote:
>>>> Ultimately I believe we need to make Rebindable palatable. That would
>>>> have the nice side effect of enabling other proxy types.
>>>
>>> I think if we get to that point, D will be much more adept at doing a
>>> lot of const things (such as ranges of const types).
>>>
>>> The big hurdle is implicit casting IMO. For example C and
>>> Rebindable!(immutable C) needs to implicitly cast to Rebindable!(const
>>> C). Right now, builtins and arrays are the only type constructions that
>>> enjoy implicit casting to their tail-const counterparts. Until we solve
>>> this, any library solution is going to be woefully inadequate.
>>
>> alias this was meant to solve this problem.
>
> My understanding is that it only works if you already have an instance.
> Will it work for implicit casting from another type?
>
> That is, is it planned to have a function foo:
>
> foo(Rebindable!(const C) c)
>
> callable with a C?
>
> What about a Rebindable!(immutable C)?
>
> -Steve

I was thinking of the conversion in the opposite direction. For the 
direct case, there has been discussion of opImplicitCast but it has 
fallen off the radar... until now I guess.

Andrei


More information about the Digitalmars-d mailing list