From: Tony Arcieri Date: 2010-01-27T04:07:28+09:00 Subject: Re: Why is the Binding object so useless? --000e0cd2c4387dedfa047e15fed6 Content-Type: text/plain; charset=ISO-8859-1 On Tue, Jan 26, 2010 at 8:07 AM, Robert Klemme wrote: > 2010/1/25 Tony Arcieri : > > I am used to Ruby being a rather reflective language that gives carte > > blanche to the programmer. So I found this rather surprising: > > > >>> Marshal.dump binding > > TypeError: no marshal_dump is defined for class Binding > > > > Whaa? > > I don't think it does make sense to serialize a binding for the same > reason that you cannot create a new binding: a binding is bound to a > particular program context - I assume this also includes caller stack > and other internal state. > Why can't bindings be independently garbage collected objects too? (as it appears they are in rbx) > Even if a binding contains local variables what is the effect of > deserializing a binding? If your local variables get updated that is > certainly not a good idea. If you want to serialize state use objects > with the proper state. > The goal is to have an object to pass to eval as the binding argument, not to update locals. Ideally I could pass a fresh binding (made with Binding.new) to eval, and when eval is finished it will be updated with whatever assignments were made in the evaluated code. I could then serialize this and persist it until the next eval call. -- Tony Arcieri Medioh! A Kudelski Brand --000e0cd2c4387dedfa047e15fed6--