On Mon, 29 Nov 2010 11:52:31 -0500, dsimcha <[email protected]> wrote:
== Quote from Andrei Alexandrescu ([email protected])'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.
One of those issues:
import std.typecons;
class C {}
void foo(Rebindable!(const C) c)
{
}
void bar(const(C) c)
{
}
void main()
{
const C x;
Rebindable!(const C) y = x;
foo(x); // line 17
bar(y); // line 18
}
produces:
testrebindable.d(17): Error: function testrebindable.foo
(Rebindable!(const(C)) c) is not callable using argument types (const(C))
testrebindable.d(17): Error: cannot implicitly convert expression (x) of
type const(C) to Rebindable!(const(C))
testrebindable.d(18): Error: function testrebindable.bar (const(C) c) is
not callable using argument types (Rebindable!(const(C)))
testrebindable.d(18): Error: cannot implicitly convert expression (y) of
type Rebindable!(const(C)) to const(C)
i.e. there is no way to produce a function that accepts both a
Rebindable!(const C) and a const C.
-Steve