Extended Type Design.

Benji Smith dlanguage at benjismith.net
Fri Mar 16 13:17:01 PDT 2007


Walter Bright wrote:
> There are 3 distinct, and very different, flavors of constant:
> 
> 1) rebinding of a value to a name
> 2) a read-only view of a data structure
> 3) a value that never changes
> 
> C++ tries to do all three with one keyword, and makes a confusing hash 
> of it.
> 
> For the purposes of discussion, and to avoid confusing ourselves, we 
> adopted working names of:
> 1) final
> 2) const
> 3) super const

I appreciate the thought you guys have put into it. And the 
implementation sounds exactly right, from a semantic perspective. It's 
just the syntax that's slightly wrong, to me.

Using your mapping above, I'd tweak it slightly to read:

1) final
2) readonly
3) const

On a side note: if the existing proposal was enacted, I think the 
exclamation point would be the most commonly overloaded symbol (possibly 
only competing with * for multiplication, pointer declaration, and 
pointer dereferencing), while other symbols (like ^ or %) are currently 
only single-purpose. Any overriding philosophy on the usage and 
overloading of symbol characters?

--benji



More information about the Digitalmars-d mailing list