Logical const

Bruno Medeiros brunodomedeiros+spam at com.gmail
Fri Dec 3 08:32:17 PST 2010


On 03/12/2010 14:03, Steven Schveighoffer wrote:
> On Fri, 03 Dec 2010 08:22:01 -0500, Steven Schveighoffer
> <schveiguy at yahoo.com> wrote:
>
>> On Fri, 03 Dec 2010 08:00:43 -0500, Bruno Medeiros
>> <brunodomedeiros+spam at com.gmail> wrote:
>
>>> The above are not trivial differences, so I do not agree that it
>>> constitutes full logical const, only a limited form of it. More
>>> concretely, it doesn't constitute logical const in in the sense where
>>> you can use that as argument to say "logical const already exists,
>>> it's just clunky to use", so let's add it to the language formally.
>>> Like if mutable members where just syntax sugar, or a betterment of
>>> safety rules.
>>
>> I disagree, I think it does prove logical const already exists. How do
>> you define logical const?
>
> I'll add to this that synchronization issues can be handled. They should
> not play a role in 'does logical const exist', they should only play a
> role in 'does efficient logical const exist'.
>
> -Steve

If by "does efficient logical const exist" you mean that we can devise 
some language rules/changes to make logical const work in D in a safe 
way, without losing the safety (and performance) guarantees that we have 
with current D with regards to immutability and concurrency, then yes, I 
think we can devise such a system. I definitely don't agree with Walter 
that "Having mutable members destroys any guarantees that const 
provides. " (unless we were to do it exactly like C++, which obviously 
we wouldn't)


Whether it is desirable or not to implement such rules in D anytime soon 
(if at all), well... that's another question altogether...

-- 
Bruno Medeiros - Software Engineer


More information about the Digitalmars-d mailing list