[nem-en] Const vs. Static non-mutable

NoiseEHC NoiseEHC at freemail.hu
Tue Feb 20 20:51:34 CET 2007


The problem with "volatile" is that it is tied to memory barriers and 
the like.
What you are trying to implement (as I see) is some syntax for 
suppressing the automatic const-ization of fields. So I thought that 
"field" would mean that it is a field and not some literal value. Better 
option is "[NotLiteral]".
BTW I do not know how many times do you want to use it. In C# I use 
"static readonly" only if "const" cannot be used because of tricky 
initialization expression.

Kamil Skalski wrote:
> "field"?  how it would be used?
>
> I think volatile is not that bad - it means: this is immutable field,
> but it can change at any moment because of "external considerations".
> As in standard flow, volatile would be a low-level hint for compiler
> not to assume that field can be pre-fetched.
>
> 2007/2/20, NoiseEHC <NoiseEHC at freemail.hu>:
>> What if we would just define a "field" keyword? Or better an "immutable"
>> keyword?
>> Using volatile is clearly confusing.
>>
>>
>>
>> _______________________________________________
>> https://nemerle.org/mailman/listinfo/devel-en
>>
>
>



More information about the devel-en mailing list