From: Sean Middleditch Date: 2002-04-07T13:26:13+09:00 Subject: Re: Is eval a code/design smell? On Sat, 2002-04-06 at 14:42, Tobias Reif wrote: > Sean Middleditch wrote: > > > > Just an example of that distributing Ruby code in binary format doesn't > > mean you're not open source, like you implied in the paragraph you cut > > out. > > > I kn[o|e]w. > After this, I wanted to know: what is binary Ruby code? > How would I generate it? Marshal what? Again, in the context you cut out, we were dicussing the "if" part of Ruby having binary format. If you want an actual implementation, there is the Ruby VM code, and Matz has said Ruby2 will be based on a VM (which is, from what I've played with, a hell of a lot easier to dump in binary format than parse trees). With the current Ruby implementation, there isn't a way I know of to dump binary Ruby code, unless you hacked together a C extension that serialized the parse into whatever format - the only issue there, of course, is storing context and state (which is *not* easy, especially when only dumping parts of a program and not the whole interpreter state). Although, of course, a way of dumping exactly not only code, but also state, is very "nifty" in that you can do some fun distributed computing things, although I haven't found much actual *use* for it yet (but Ruby people are more into the fun of it anyways, right? ~,^ ). A more useful reason to be able to serialize Ruby code, including context, would be to dump state information in the event of a restart or whatnot; i.e., an embedded Ruby interpreter in a persistant server, that needs to be able to save/shutdown, but start right back up where it left off. Of course, granted, a language that can do that might as well have eval() - both operations are going to be incredibly unsafe. ^,^ > > Tobi > > > -- > Neither simple nor complex matters are to be complicated. >