From: hipster Date: 2000-10-27T22:19:23+09:00 Subject: [ruby-talk:5911] Re: [RFC] Towards a new synchronisation primitive On Fri, 27 Oct 2000 21:26:37 +0900, Dave Thomas wrote: > > I'd say the point of definition of a method is at the end of the def > > expression, before any method body expressions. Therefore only the > > method body is subject to sync-behaviour. > > I can see cases where that wouldn't work, such as: > > class RingBuffer > > def sync initialize > @inPtr = @outPtr = 0 > end > > def sync printBuff(from = @inPtr, to = @outPtr) > # ... > end > end > > If synchronization only applies to the method body, its possible that > from gets assigned @inPtr in one state, then something else runs, and > to gets @outPtr in another state. Not critical in this case, but I > guess it could be. You're absolutely right. My point-of-definition argument has nothing to do with this. Parameter initializers should be considered a kind of 'method constructors', and should be part of the same method synch scope. thanks, Michel