December 03, 2007 Re: Const Ideas | ||||
---|---|---|---|---|
| ||||
Posted in reply to Craig Black | Craig Black wrote:
> If that is correct, then transitivity just seems like an artificial restriction for no reason. It's not like we are violating some fundamental law here. I still don't see a good reason not to allow "C const c" syntax. To me, it's straightforward. However, it may complicate the compiler implementation. I wouldn't know.
You're right in that it's an artificial restriction.
As for complicating the implementation, I doubt that. It should be easier to do head-const than transitive const. You have to arrange for an initial assignment, which could be awkward.
The main issue is language bloat, I think. This is a common feature of other languages, though, so that in itself is an argument in favor of considering the feature. And the fact that it can help find local bugs is an argument in favor of implementing it.
I think people have been expecting const always to give a rebindable reference for reference types, and then wanting final in addition. Maybe. But I'm not sure.
|
Copyright © 1999-2021 by the D Language Foundation