To share or not to share, this is the question.
Dmitry Olshansky
dmitry.olsh at gmail.com
Mon Oct 17 05:45:45 PDT 2011
On 17.10.2011 14:24, Gor Gyolchanyan wrote:
> The shared keyword makes it's user regret ever trying to use it.
> This keyword has a single purpose: it generates frustration at compile-time.
> Enough with the emotions.
> I'm trying to make a Win32 multi-threaded warpper, which allows to
> efficiently create Win32 windows, that immediately start processing
> their messages in a separate thread (which will eventually get
> migrated into a thread pool).
> As i was trying to deal with the shared-ness, i found out about this:
>
> shared class T
> {
> alias void* v;
I guess the problem is here: v is void * and not shared at all. Alias is
not affected by outer shared decl, shared applies only to members:
fields and functions. In a sense, an alias is merely using the same name
scope.
Imagine if you semantics (i.e. shared affects aliases) worked, then how
would you declare a *not* shared type alias inside of it ?
This won't work:
alias Unqual!(void*) v;
--
Dmitry Olshansky
More information about the Digitalmars-d
mailing list