From: Pierre-Charles David Date: 2006-03-30T00:02:16+09:00 Subject: Re: strange order of execution On 3/29/06, James Edward Gray II wrote: > On Mar 29, 2006, at 2:53 AM, vsv wrote: > > > I belive Ruby will get implemented in bytecode eventually, at that > > time > > 'compile' time evaluation feature will be required; and then, I hope, > > we'll get 'read' time evaluation too (just dreaming :) > > We have it today: > > >> ruby_code = "2 + 2" > => "2 + 2" > >> "2 + 2 = #{eval(ruby_code)}" > => "2 + 2 = 4" This is "read-time" evaluation only because currently read-time == evaluation time. If Ruby had a compilation phase, string interpolation would need to be done at execution time. Otherwise a simple program such as puts "Hello, #{gets}" would require user input during the compilation phase... Common Lisp for example has both compile-time evaluation (macros, (eval-when (:compile) ...)) and read-time evaluation (#., #+ and #-, the last two being used a little like #ifdef/#ifndef).