From: Logan Capaldo Date: 2006-05-25T06:29:39+09:00 Subject: Re: Zed and Luis drop the bomb on Ruby's poor performance On May 24, 2006, at 5:08 PM, Christian Neukirchen wrote: > "Douglas Livingstone" writes: > >>> How about we rewrite the ruby runtime as a combination of macros and >>> functions in Lisp, use ParseTree to get the S-Exp representation >>> of a >>> ruby program and then feed that into our Lisp compiler? Instant >>> speedy ruby! ;) > >> ((defn >> sum >> (scope >> (block >> (args a b) >> (return (call (lvar a) + (array (lvar b))))))) >> (lasgn a (lit 3)) >> (lasgn b (lit 4)) >> (lasgn c (fcall pythag (array (lvar a) (lvar b)))) >> (fcall puts (array (lvar c)))) >> >> So, it looks like Lisp to me! Now, some macros? > > Now try to port the Ruby object system to CL so it will have > reasonable runtime performance. > > Good luck. > I'm pretty sure CLOS is a super-set of the ruby object system. Only thing I'm not sure of is Mixins and singleton methods, but I don't imagine Mixins to be too hard to add if necessary. One could just define a module, and then when one included it in a class just have a macro go down the list of methods in the Module and define them for the class (basically #append_features). Singleton methods are harder, but one could probably do what is done in ruby, (construct a class on the fly that inherits from an objects real class and change the objects class to this new class.). We already get handling all the inheritance stuff for free (and arrays and strings, numbers etc.). >> Douglas > -- > Christian Neukirchen http:// > chneukirchen.org >