But now anything that does not override hash will have some problems
I had a quick look at the Javascript implementations of the other const classes in sys, and the following don't seem to have hash() implementations either:
Bool
Charset
Decimal
Enum
Log
Pod
Slot
TimeZone
Type
Do these need updating too?
andyThu 24 Nov 2016
Yes most likely - let me run through them and see - thanks Steve
SlimerDude Sat 19 Nov 2016
A simple program that keeps calling
Map.getOrAdd()until the same key is added:@Js class Example { private Uri:Str vals := [:] Bool addVal(Uri key) { added := false vals.getOrAdd(key) |->Str| { added = true; return "Val" } return added } Void main() { while (addVal(`key`)) { echo(vals) } } }Works fine in Java and only adds
keythe once:But enters an infinite loop in Javascript:
Note it works fine if you change the map to a primitive key, such as:
andy Mon 21 Nov 2016
Are you working off tip?
SlimerDude Mon 21 Nov 2016
It was 1.0.69, but I've just compiled
tipand I'm still seeing the issue when I run the example in a browser.andy Mon 21 Nov 2016
Ticket promoted to #2577 and assigned to andy
Yeah - actually my last fix to "fix" it - actually broke it :)
Obj.hash used to return
0- which would cause some interesting things to happen :) So I fixed that to return an increasing id by default.But now anything that did not override
hashwill have some problems - in this case its Uri. Should be an easy fix - I'll look tomorrow.andy Tue 22 Nov 2016
Ticket resolved in 1.0.70
Fixed - changeset
SlimerDude Tue 22 Nov 2016
Hi,
Cool!
I had a quick look at the Javascript implementations of the other
constclasses insys, and the following don't seem to havehash()implementations either:BoolCharsetDecimalEnumLogPodSlotTimeZoneTypeDo these need updating too?
andy Thu 24 Nov 2016
Yes most likely - let me run through them and see - thanks Steve
andy Thu 8 Jun 2017
Fixed Bool and Decimal - others look ok