At 02:08 PM 2/15/2001 -0800, Hong Zhang wrote:
> > Hong Zhang wrote:
> >
> > > This code should NEVER work, period. People will just ask for trouble
> > > with this kind of code.
> >
> > Actually I meant to have specified ">>" as the mode, i.e. append, then
> > what I originally said holds true.  This behaviour is predictable and
> > dependable in the current perl implementation.  Without the >> the file
> > will contain just "bar\n".
>
>That was not what I meant. Your code already assume the existence of
>reference counting. It does not work well with any other kind of garbage
>collection. If you translate the same code into C without putting in
>the close(), the code will not work at all.

People are getting garbage collection and perl's "object going out of 
scope" behaviour confused. This is starting to annoy me.

Refcounts are not in any way required for perl's leaving scope behaviour. 
They're a convenient way to implement it, but it isn't the only way, and it 
isn't necessarily the best, either.

>By the way, in order to use perl in real native thread systems, we have
>to use atomic operation for increment/decrement reference count.

Only for shared variables. And an atomic operation is rather a fuzzy thing 
anyway. (With POSIX thread support, we can build some darned big atoms) We 
certainly aren't forced to use single machine instructions to do this.


                                        Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to