From: "Michael C. Libby" Date: 2003-01-06T05:58:43+09:00 Subject: Re: Compile time constant folding? -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Sunday 05 January 2003 14:26, Dan Sugalski wrote: > Is it valid to do compile-time constant folding as an optimization? > > I know statements like > > a = 1 + 2 > > may have interesting runtime behaviours if addition is overloaded for > fixnums, but is that guaranteed, or is it OK if the compiler reduces > that to Short answer? No. I think you answered your own question: "interesting runtime behaviours if addition [really the '+' method] is overloaded for fixnums". If it is possible to overload this method at any time after compile (which it is via eval or require), how can the compiler possibly know what to use in the folded code? Maybe as an option to the compiler? Sort of a contract with Parrot that you won't overload a specific set of commands in order to facilitate efficiency in the resulting byte code? -michael -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE+GJtG4ClW9KMwqnMRAiwQAKCB1DuWo3AKla0ipUczKZvQKdELRgCfT9yP 8WWONLtYWIodlyv/Q1EghGs= =DoL6 -----END PGP SIGNATURE-----