id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,os,architecture,failure,difficulty,testcase,blockedby,blocking,related
1236,System.Mem.Weak breaks referential transparency,drtomc@…,,"Consider the following two functions:

foo = do
    mkWeakPtr y (Just launchMissiles)
    return y
    where
    y = 42

bar = do
    mkWeakPtr 42 (Just launchMissiles)
    return 42

These two functions are equivalent right? After all referential transparency means that if y = 42, then anywhere y occurrs I can write 42. The problem is that if I call foo, and hang on to the return value, then launchMissiles won't be called until some time after I stop using the return value, but if I call bar, then launchMissiles may be called any time, including before bar returns!

Looks to me like finalizers break referential transparency, so System.Mem.Weak is broken, though I'm quite willing to be proven wrong.

cheers,
Tom",bug,closed,normal,,libraries/base,6.6,invalid,,,Unknown/Multiple,Unknown/Multiple,,Unknown,,,,
