chicken-janitors
[Top][All Lists]
Advanced

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

[Chicken-janitors] #1476: (scrutinizer) Should global types be smashed i


From: Chicken Trac
Subject: [Chicken-janitors] #1476: (scrutinizer) Should global types be smashed in local contexts?
Date: Fri, 15 Jun 2018 08:31:08 -0000

#1476: (scrutinizer) Should global types be smashed in local contexts?
-------------------------+----------------------------
 Reporter:  megane       |                 Owner:
     Type:  task         |                Status:  new
 Priority:  minor        |             Milestone:  5.1
Component:  scrutinizer  |               Version:  5.0
 Keywords:  smashing     |  Estimated difficulty:
-------------------------+----------------------------
 Currently types for globals are not smashed. Should they be smashed in,
 say functions?

 Similar to #1475.

 {{{
 (define-type type (vector (or fixnum symbol)))
 (: g type)
 (define g (vector (the * 1)))

 ;; define pure alias, so printing doesn't smash
 (: p (* --> undefined))
 (define p print)

 (define (foo)
   (compiler-typecase g (type (p "global ok")))
   (vector-set! g 0 'foo)
   (compiler-typecase g (type (p "global not smashed")))

   (let ([l g])
     (compiler-typecase l (type (p "alias ok")))
     (compiler-typecase l (type (p "alias ok after printing")))
     (vector-set! g 0 'foo)
     (compiler-typecase g (type (p "global not smashed")))
     (compiler-typecase l
       (type 'oop)
       ((vector *) (p "alias smashed"))))

   (compiler-typecase g
     (type (p "global not smashed"))
     ((vector *) (p "global smashed"))))
 (foo)

 ;; $ csc -O3 global-smashing.scm && ./global-smashing
 ;; global ok
 ;; global not smashed
 ;; alias ok
 ;; alias ok after printing
 ;; global not smashed
 ;; alias smashed
 ;; global not smashed

 }}}

--
Ticket URL: <https://bugs.call-cc.org/ticket/1476>
CHICKEN Scheme <https://www.call-cc.org/>
CHICKEN Scheme is a compiler for the Scheme programming language.

reply via email to

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