chicken-janitors
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-janitors] #986: (define ++ string-append) defeats constant-fold


From: Chicken Trac
Subject: [Chicken-janitors] #986: (define ++ string-append) defeats constant-folding
Date: Wed, 20 Feb 2013 22:28:28 -0000

#986: (define ++ string-append) defeats constant-folding
-------------------------------+--------------------------------------------
 Reporter:  zbigniew           |       Owner:         
     Type:  enhancement        |      Status:  new    
 Priority:  not urgent at all  |   Milestone:  someday
Component:  unknown            |     Version:  4.8.x  
 Keywords:                     |  
-------------------------------+--------------------------------------------
 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
 }}}

-- 
Ticket URL: <http://bugs.call-cc.org/ticket/986>
Chicken Scheme <http://www.call-with-current-continuation.org/>
Chicken Scheme is a compiler for the Scheme programming language.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]