hughperman / pure-lang

Automatically exported from code.google.com/p/pure-lang
0 stars 0 forks source link

Taking hash of an anon closure crashes #82

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
> hash (\x->x);
Assertion failed: (x->tag>0), function hash, file runtime.cc, line 12294.
Abort trap: 6 (core dumped)

What is the expected output?
Expect not to crash.

Using Pure 0.53 on FreeBSD

Original issue reported on code.google.com by dubious...@gmail.com on 21 Jun 2012 at 8:27

GoogleCodeExporter commented 8 years ago
Also, would like hash to be provided. Their hash can just be: hash (get_pointer 
(ref f)).

Original comment by dubious...@gmail.com on 21 Jun 2012 at 8:30

GoogleCodeExporter commented 8 years ago
This issue was closed by revision d2a3ed9f36f2.

Original comment by aggraef@gmail.com on 23 Jun 2012 at 10:33

GoogleCodeExporter commented 8 years ago
The assertion should be fixed. But I'm not sure if I understand your comment 
#1, can you elaborate? Note that the hash value of a closure is based on its 
key which uniquely identifies the underlying function. It's not based on the 
pointer to the closure object, if that's what you mean.

Original comment by aggraef@gmail.com on 23 Jun 2012 at 10:41

GoogleCodeExporter commented 8 years ago

Original comment by aggraef@gmail.com on 23 Jun 2012 at 10:42

GoogleCodeExporter commented 8 years ago
It was just a suggestion about how the hash value could be derived. I 
understand your comment to mean that closures with the same underlying function 
but different environments nonetheless hash the same. (I presume they won't be 
===.)

Original comment by dubious...@gmail.com on 24 Jun 2012 at 1:49

GoogleCodeExporter commented 8 years ago
Ah yes, I see. It certainly makes sense to include the environment in the hash. 
(And yes, === works ok, it does compare the environments.)

Original comment by aggraef@gmail.com on 24 Jun 2012 at 10:37

GoogleCodeExporter commented 8 years ago
This issue was closed by revision dce8bce7e7ea.

Original comment by aggraef@gmail.com on 24 Jun 2012 at 11:07