tail const

Fawzi Mohamed fawzi at gmx.ch
Thu Dec 2 05:34:29 PST 2010


On 2-dic-10, at 13:09, Michel Fortin wrote:

> 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.

ok, eheh I just realized that also the tail shared protection has  
exactly the same constraints as the weak const (or tail const), and  
also for that it seems that the more complex struct case was scrapped,  
restricting it to pointer array and refs.

> 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