Hi, On Thu 24 Jun 2010 09:52, Michael Lucy <michaelgl...@gmail.com> writes:
> scheme@(guile-user)> ,c (begin a b 1) > Disassembly of #<objcode d123d28>: > > 0 (assert-nargs-ee/locals 0) > 2 (load-symbol "a") ;; a > 7 (link-now) > 8 (variable-ref) > 9 (drop) > 10 (load-symbol "b") ;; b > 15 (link-now) > 16 (variable-ref) > 17 (drop) > 18 (make-int8:1) ;; 1 > 19 (return) > > Out of curiosity, why are variables left in? Are there situations > where evaluating a variable will have side-effects? Global variable references can cause side effects (exceptions, module autoloads, binders, duplicates handlers, etc) so they are not optimized out. Lexical references cannot cause side effects, so they are optimized out. Andy -- http://wingolog.org/