Open ChayimFriedman2 opened 4 years ago
I have a patch for that, that introduce *::hash
getter. There is one
major issue with it, because of the lack of reentracy, you can't expect
internal Map
to use the getter. So you end up having to recreate an
external HashMap
class.
Why? most languages do that.
Reentracy is required to do that.
But we need it reentrant anyway. So when we'll have a solution...
It can be introduced with that reentracy limit, till it gets fixed.
It can, but I think it's confusing. However we can tell reentrancy is a bug then it's OK 😄.
We already have an iterator protocol, so why not have a hash protocol, say a method
hash()
? All we need to change is this:https://github.com/wren-lang/wren/blob/45c67fae0c2fbe78b608d372d0951ffe05f02690/src/vm/wren_value.c#L410-L412
Then we can simplify the code and just let the builtins have
hash()
method, but I'll not sure if this will degrade performance.