What purpose to const besides functional programming?

Koroskin Denis 2korden at gmail.com
Thu Jul 24 07:13:10 PDT 2008


On Thu, 24 Jul 2008 17:14:01 +0400, Jason House  
<jason.james.house at gmail.com> wrote:

> Simen Kjaeraas Wrote:
>> You are expecting invariant member functions to not do things they can
>> and should do.
>
> My example was in response to Walter's statement (#5) that invariant  
> objects can be accessed without synchronization.  I was providing a  
> simple counter example.

Yes, presicely:
> invariant objects can be accessed without synchronization.

By contrast, your example wasn't accessing invariant objects but rather  
executed invariant function. Don't compare soft with green. The data that  
was accessed wasn't invariant, it was mutable. However, if global x and y  
were invariant, that function would be thread-safe and woudn't require  
synchronization.



More information about the Digitalmars-d mailing list