Opened 4 years ago

Closed 4 years ago

#10824 closed bug (invalid)

Strict let-bindings are processed backwards

Reported by: ezyang Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.10.1
Keywords: Cc: goldfire
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description (last modified by ezyang)

Consider this module:

main = do let !x = error "bar"
              !y = error "foo"
          print (x + y)

or this analogous module:

{-# LANGUAGE MagicHash #-}
import GHC.Exts
main = do let x = error "bar" :: Int#
              y = error "foo" :: Int#
          print (I# x + I# y)

When you run these, you will get the error "foo" and not the error "bar". This is backwards!

Change History (3)

comment:1 Changed 4 years ago by ezyang

Description: modified (diff)
Summary: Let-bindings of kind # are processed backwardsStrict let-bindings are processed backwards

comment:2 Changed 4 years ago by simonpj

I don't think we should offer any guarantee for what happens in this case. Our imprecise-exceptions paper says why.

I'm not against making the by-default behaviour a bit more intuitive but I don't think we should specify an evaluation order.

So I suggest "invalid" here.

comment:3 Changed 4 years ago by ezyang

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.