D's greatest mistakes

Steven Schveighoffer schveiguy at yahoo.com
Mon Nov 29 11:49:35 PST 2010


On Mon, 29 Nov 2010 14:38:40 -0500, Andrei Alexandrescu  
<SeeWebsiteForEmail at erdani.org> wrote:

> 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.)

At some point, Rebindable may be as good as a language feature.  But we  
haven't got there yet.  And we haven't got there in years.  And I don't  
see us getting there in the forseeable future -- there are too many  
implicit casting problems to solve.

At the point where it does become useable, how big will it be?  How much  
will it slow down compilation?  How specialized do we have to make code?

Const is supposed to be a compile-time feature, optimized out at runtime.   
If Rebindable isn't completely removed from the code generation, then it  
is not a complete feature.

>
>> 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);
>      ...
> }

You missed the point.. completely :)

please look at bar.

-Steve


More information about the Digitalmars-d mailing list