From: Dan Sugalski Date: 2003-01-06T11:15:46+09:00 Subject: Re: Compile time constant folding? At 9:32 AM +0900 1/6/03, Yukihiro Matsumoto wrote: >Hi, > >In message "Compile time constant folding?" > on 03/01/06, Dan Sugalski writes: > >|Here's a quick question, now that parrot's close to getting object >|support and the cardinal folks are on their way to a working parser... >| >|Is it valid to do compile-time constant folding as an optimization? > >I didn't take it, because > > * every method may be redefined (e.g. "+") in dynamic languages. > > * besides, foldable expressions are rather simple, so that it does > not save much time. You'd be surprised, especially when you factor in some other optimizations--you can do some substitutions and inferences of variable contents. Because of it, some expressions that look like they're variable, such as: a = 12 b = 8 c = a + b are really constant. (And yes, that is really cut down and excessively simplified) Still, if it's not allowed that's fine. The question came up and, since I have a bunch of other things I should do first, I couldn't let it go without finding out. Thanks, Matz. >The latter assumption may not be true for Parrot, which has much >faster and more optimized runtime. We'll see--you still need to beat us with sprite. ;) -- Dan --------------------------------------"it's like this"------------------- Dan Sugalski even samurai dan@sidhe.org have teddy bears and even teddy bears get drunk