tail const

Michel Fortin michel.fortin at michelf.com
Thu Dec 2 04:09:27 PST 2010


On 2010-12-02 05:57:18 -0500, Fawzi Mohamed <fawzi at gmx.ch> said:

> well as your are at it I would argue a bit more on the syntax.
> [...]
> I suppose that will probably considered too difficult to implement,  
> but I wanted to propose it again because I find that it is the most  
> clean solution conceptually.

It is significantly more complex, not only for the compiler but also 
for the one reading/writing the code, as you'd have to propagate that 
'weak_const' as a new, distinct modifier for it to be usable across 
function calls. I don't think it's worth it really.

As for the syntax for classes, I feel "const(Object)ref" with the 
optional ref marker is easier to grasp than introducing a new concept 
called 'weak_const'. I welcome any suggestions, but my aim is to keep 
the changes as small and localized as possible in the compiler and 
follow as closely as possible existing language patterns.

My only concern with the "const(Object)ref" syntax is that we're 
reusing 'ref' to denote an object reference with different properties 
(rebindable, nullable) than what 'ref' currently stands for. But it 
remains the best syntax I've seen so far.

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/



More information about the Digitalmars-d mailing list