[dmd-beta] dmd 2.064 beta take 2

Andrei Alexandrescu andrei at erdani.com
Wed May 15 14:19:55 PDT 2013


On 5/15/13 5:14 PM, Walter Bright wrote:
> It means I can't read the code and easily determine what that const
> value is, even though it is explicitly initialized with a value.

I now understand the concern. I'd argue that static immutable/const 
fulfills that role, and that a member const is supposed to be 
initialized in a constructor (or via the default initializer syntax as 
for any other member) and stay constant throughout the lifetime of the 
object. That _is_ a very useful notion.

I'm not assuming you're proposing this, but I'm clarifying just in case: 
a member that takes per-instance memory YET always has the same value in 
all objects would be positively useless. _That_ should at best be an error.


Andrei


More information about the dmd-beta mailing list