iterators again

Walter Bright newshound1 at digitalmars.com
Sat Jun 2 16:26:21 PDT 2007


Bruno Medeiros wrote:
> Walter Bright wrote:
>> Bruno Medeiros wrote:
>>> Hum, you're right, it should type to const instead of invariant, I 
>>> totally missed that. However I missed because I'm trying to look into 
>>> another issue, what I really want to know is if the full type of 
>>> (*(&foo)) will be the same as (foo), and so far it seems not, 
>>> according to what Walter's said. So
>>>   typeof(foo) is:  final Foo
>>> but
>>>   typeof(*(&foo)) is:  const(Foo)
>>> which seems a breach in orthogonality, and meaning that this won't be 
>>> allowed:
>>>   (*(&foo)).membervar = 42;
>>
>> final is not a type constructor, it is a storage class. And no, you 
>> won't be able to change the contents of an instance of a final struct, 
>> even if you do machinations to do so.
> 
> I should have clarified, Foo there is supposed to be a class, not a struct.

You can still change the members of a final class instance.



More information about the Digitalmars-d mailing list