D's greatest mistakes

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Nov 29 11:38:40 PST 2010


On 11/29/10 1:35 PM, Steven Schveighoffer wrote:
> On Mon, 29 Nov 2010 11:52:31 -0500, dsimcha <dsimcha at yahoo.com> wrote:
>
>> == Quote from Andrei Alexandrescu (SeeWebsiteForEmail at erdani.org)'s
>> article
>>
>>> Ultimately I believe we need to make Rebindable palatable. That would
>>> have the nice side effect of enabling other proxy types.
>>> Andrei
>>
>> I've asked before and I'll ask again, what's still wrong with
>> Rebindable? A bunch
>> of alias this issues got fixed in 2.050, and I fixed a bunch of misc.
>> convenience
>> issues a few releases ago. I fail to see the problem with it anymore.
>
> Every few months or so, someone finds a problem with it. It seems that
> it's good enough in theory, but miserably fails in practice when someone
> tries to use it. I admit I haven't looked at it in a while, but there
> are implicit casting problems that cannot be solved without compiler
> help. I just think Rebindable will get more and more convoluted until
> someone finally admits that this is better served as a builtin feature.

I don't grok this. If people find different issues with it that are 
fixed, then there is progress, right? (Clearly "escaping" into the 
language makes things better.)

> One of those issues:
>
> import std.typecons;
>
> class C {}
>
> void foo(Rebindable!(const C) c)
> {
> }

Let me fix that:

void foo(const C c)
{
     auto rc = Rebindable!(const C)(c);
     ...
}


Andrei


More information about the Digitalmars-d mailing list