The Status of Const

Jonathan M Davis jmdavisprog at gmail.com
Fri Aug 13 17:06:15 PDT 2010


On Friday, August 13, 2010 16:30:46 dsimcha wrote:
> I still don't understand:  What's so bad about Rebindable?  Yes, it's not
> the syntactically prettiest thing in the world, but complaining about it
> is like complaining about climbing a molehill when you've got Mount
> Everest to climb next. My previous gripe about it was that it didn't
> support interfaces, but I just realized that Shin Fujishiro fixed this a
> while back.

Well, first of all, the code is much uglier with it, though that's arguably a 
fairly superficial complaint. Part of it is the fact that it really _should_ be 
in the language itself rather than having to use Rebindable. Honestly, I haven't 
messed with it in a while, so I don't remember all of the issues. I've never 
liked it, and I've always had trouble in getting it to work. Now, maybe that's 
totally due to bugs that may be fixed now, but it's always been problematic, and 
certainly my gut reaction is that the type system is deficient because it can't 
do it itself. Having to use Rebindable!() is definitely worse than being able to 
do things like const (T)*. But maybe with all of the bugs worked out and just 
getting used it, it's a good and reasonable solution. Honestly though, I've 
never been able to get it to work right, and I've never been happy about the 
fact that the type system can't handle it itself. Obviously, I need to go back 
and try and use it again. However, with inout broken and Object not being const-
correct, I'm not sure that I'll get very far with using const and immutable 
anyway. Still, it would be so nice if it could just be handled cleanly by the 
type system.

- Jonathan M Davis


More information about the Digitalmars-d mailing list