Shared Delegates

Andrew Wiley wiley.andrew.j at gmail.com
Wed Oct 19 21:58:39 PDT 2011


On Wed, Oct 19, 2011 at 9:38 PM, Robert Jacques <sandford at jhu.edu> wrote:

> On Wed, 19 Oct 2011 20:51:25 -0400, Michel Fortin <
> michel.fortin at michelf.com> wrote:
>
>> On 2011-10-19 21:53:12 +0000, Andrew Wiley <wiley.andrew.j at gmail.com>
>> said:
>>
>
> [snip]
>
> Also, I how shared works is being misunderstood. Making a class
> synchronized should limit all member functions and field to being shared or
> immutable, but it doesn't place any limits on the argument to the member
> functions. So in the below:
>
>
> synchronized class Thing2 {
>        void doSomeWork(int i) {}
>        void doSomeOtherWork(Thing2 t) {}
>        void work() {}
> }
>
> i is of type int, not shared(int).
>


Ah, I see, so I can pass unshared data or references to unshared data into
member functions, and the type system keeps me from saving them to member
fields because member fields will be flagged as shared, but the arguments
need not be. That makes a lot more sense.
Sorry for the noise.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20111019/05e92697/attachment.html>


More information about the Digitalmars-d mailing list