From: MikkelFJ Date: 2002-08-09T18:43:50+09:00 Subject: Re: Compiling Ruby to Native Code? "Tord Kallqvist Romstad" wrote in message news:gqk1y99en66.fsf@nereids.uio.no... > llothar@web.de (Lothar Scholz) writes: > Even with dynamic typing, the compiled code would probably perform > much better than interpreted Ruby. Add optional type declarations > (like in Lisp), and it should be possible to achieve the same speed as > with optimized Lisp code. > > Do you disagree? If so, what properties of Ruby make it harder to > compile than Lisp? Ruby is a mutating monster so you have to look up functions in a hash. You can optimize this by building a virtual table that gets invalidated when a class is modified, but it can be tricky to know when this is worthwile. To support efficient compilation, a modified version would be needed that optionally allows type annotations and which disallows modifying the type of an object the has been created (either prevent class modification, or make it a new type internally). > > Never written a compiler - right ? > > Of course I have. Obviously, who hasn't ;-) Mikkel