When is casting const() away actually necessary? (Used to be: Re: Why D const is annoying)
Steven Schveighoffer
schveiguy at yahoo.com
Thu May 3 06:40:41 PDT 2012
On Wed, 02 May 2012 12:59:34 -0400, David Nadlinger <see at klickverbot.at>
wrote:
> On Wednesday, 2 May 2012 at 16:52:33 UTC, Alex Rønne Petersen wrote:
>> shared? Almost always in any non-trivial application. shared is only
>> useful if you're dealing with templatized functions that can actually
>> handle it, which is not the case as often as one would like.
>
> Additionally, shared is currently little more than a marker for non-TLS
> data.
No, it's very important that it is a type constructor. For example, it
makes weak-pure functions possible.
I think there is a large piece of shared missing/undefined, and that is,
how do I mark something shared as "temporarily local". I think Bartosz
proposed something like "lent".
We essentially need the equivalent of const for shared. Const unifies
immutable and mutable, we need something to unify shared and thread-local.
The problem is, something like this needs to be combined with
thread-locks. I wonder if some kind of ARC would be useful for
automatically unlocking the data.
-Steve
More information about the Digitalmars-d
mailing list