[racket-dev] Potential Constant Propagation Bug

2013-03-29 Thread Vincent St-Amour

I have found what I think may be a bug in Racket's constant propagation:

   (unsafe-fx* 0 (error 'foo))

does not throw and error and evaluates to 0. If 0 is replaced with
another value, or if it's `read' in, the error is thrown.
`unsafe-fxquotient' has the same issue.

On the one hand, this is an unsafe operation, so maybe I shouldn't
expect the error to be thrown. On the other hand, I would expect
effectful arguments to functions to be evaluated no matter what.

Is this a bug, or is this the desired behavior for unsafe operations?

Vincent
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Potential Constant Propagation Bug

2013-03-29 Thread Matthew Flatt
Yes, this is clearly a bug.

At Fri, 29 Mar 2013 16:21:49 -0400, Vincent St-Amour wrote:
 
 I have found what I think may be a bug in Racket's constant propagation:
 
(unsafe-fx* 0 (error 'foo))
 
 does not throw and error and evaluates to 0. If 0 is replaced with
 another value, or if it's `read' in, the error is thrown.
 `unsafe-fxquotient' has the same issue.
 
 On the one hand, this is an unsafe operation, so maybe I shouldn't
 expect the error to be thrown. On the other hand, I would expect
 effectful arguments to functions to be evaluated no matter what.
 
 Is this a bug, or is this the desired behavior for unsafe operations?
 
 Vincent
 _
   Racket Developers list:
   http://lists.racket-lang.org/dev
_
  Racket Developers list:
  http://lists.racket-lang.org/dev