lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Wed, 27 May 2009 08:47:38 +0200
steve donovan <steve.j.donovan@gmail.com> wrote:
> 
> Have a look at:
> 
> http://lua-users.org/lists/lua-l/2008-01/msg00138.html
> 
> RAII (so beloved of C++) is a very useful pattern
> 

Thank you. I must have overlooked that since I wasn't intending to add
syntax. This should help with the linkset, since only a deranged script
would dare copy an active iterator to a global variable.

For the event data, I found that it's a reference-counted pointer
already, so I can just increment that, and it doesn't matter how long it
takes the data to be collected.

Out of curiosity, what are the pros and cons of the __copy metamethod?
The last discussion of this I found[1] ended without a clear answer. A
difficulty I forsee is that you'd also need copy-on-write, else you'll
waste a lot of time copying values when a reference would suffice. 

[1] http://lua-users.org/lists/lua-l/2006-06/msg00092.html

-- tom
telliamed@whoopdedo.org