[dmd-concurrency] Defining shared delegates

Michel Fortin michel.fortin at michelf.com
Tue Jan 19 13:03:34 PST 2010


Le 2010-01-19 à 15:20, Andrei Alexandrescu a écrit :

> One suggestion about shared delegates: should we take the executive decision to not define them at all? There's nothing you can do with delegates that you can't do with classes. Although generally delegates do justify their existence because they're more comfy than e.g. local classes, it doesn't strike me as obvious we'll need comparable convenience when dealing with shared classes.

The reason I wrote all this is because I think delegates can be much easier to work with than classes. That's what I tried to demonstrate.

That's because delegates completely encapsulate the "sharedness" of what they touch, which means that contrary to other types you can implicitly convert a shared delegate to a thread-local one. This should make them much easier to share than most other types, including classes.


-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/





More information about the dmd-concurrency mailing list