On Thu, Feb 27, 2003 at 04:00:43PM +0900, Bulat Ziganshin wrote: > DC> 2) Give Ruby a '-O' option that does constant folding and raises an error > DC> if you either change the value of a constant > > but how? :) Currently, if Ruby sees 'MYCONST = ...' more than once, or in a context where it's value can change it produces a warning. I suggest that in "optimization mode" it would stop execution instead. By guaranteeing that the value of MYCONST doesn't change, you can do things like constant folding. > DC> or overload Fixnum#+. > > i have another idea - program can include statements like > > "freeze Fixnum, String, Regexp" > > that guarantees to optimizer that appropriate classes will be not > changed after this statements and methods of this classes can be > dispatched as "finalized" (in terms of Java) That sounds like a good idea to me. That might even allow more kinds of optimizations too. -- Daniel Carrera Graduate Teaching Assistant. Math Dept. University of Maryland. (301) 405-5137