so what exactly is const supposed to mean?
Lars Ivar Igesund
larsivar at igesund.net
Mon Jul 3 11:45:45 PDT 2006
Hasan Aljudy wrote:
> Lars Ivar Igesund wrote:
>> Hasan Aljudy wrote:
>>
>>>damn, this doesn't sound too good.
>>>I for one don't give a damn about const, so why should I be bothered to
>>>think about the constness of my code/classes and add "mutable"
>>>qualifiers all over the place?
>>
>>
>> Hmm, this sounds bad, for you ... you are aware that immutable objects
>> are your guarantee in multithreaded system to have safe sharing of data?
>> Have you looked at any well designed library in languages like C++, Java
>> or C#? Try to count the immutable classes present, I think you'll find
>> quite a few.
>>
>
> Let me repeat:
> Is there anything preventing anyone from creating immutable classes?
Do you see that question at all in your quote above? As it is, it is rather
difficult making immutable classes in D, much because the OOP rules in D
has deteriorated lately, and the spec has as well. In addition there really
is no construct making any useful guarantees about constness, neither for
classes nor for code not using classes (which I'm well aware that you
abhor).
--
Lars Ivar Igesund
blog at http://larsivi.net
DSource & #D: larsivi
More information about the Digitalmars-d-learn
mailing list