id summary reporter owner description type status priority milestone component version resolution keywords cc difficulty 986 (define ++ string-append) defeats constant-folding Jim Ursetto evhan "Using (define ++ string-append) prevents constant-folding into a literal string when using ++. It does work when using -block, but not inside a module, even when ++ is hidden. Or at least, I can't get it to work. {{{ ;; app2.scm ;; although string-append is substituted for ++, the result is not ;; constant-folded, unlike plain string-append (module foo (bar baz) (import scheme chicken) (define ++ string-append) (define (bar) (print (string-append ""foo"" ""bar"" ""baz""))) (define (baz) (print (++ ""quux"" ""poop""))) ) (import foo) (bar) (baz) }}} {{{ ;; ---------- $ csc -O3 -debug o app2.scm hiding nonexported module bindings: foo#++ specializations: 1 (string-append string string) safe globals: (foo#baz foo#bar foo#++) removed side-effect free assignment to unused variable: foo#++ folded constant expression: (string-append (quote ""foo"") (quote ""bar"") (quote ""baz"")) substituted constant variable: a213 substituted constant variable: a214 replaced variables: 2 removed binding forms: 3 contracted procedure: k202 removed binding forms: 6 substituted constant variable: a201 inlining procedure: ""(app2.scm:15) foo#baz"" inlining procedure: ""(app2.scm:14) foo#bar"" substituted constant variable: a201229 replaced variables: 2 removed binding forms: 1 removed binding forms: 3 }}}" enhancement closed not urgent at all 4.10.0 compiler 4.8.x fixed