Type | Bug | Status | reviewed | Date | 12-Mar-2014 05:01 |
---|---|---|---|---|---|
Version | r3 master | Category | Datatype | Submitted by | rgchris |
Platform | All | Severity | minor | Priority | high |
Summary | Possible duplicate keys in map! |
---|---|
Description | It's possible to create duplicate keys in a map when using a series as a key. If you set two keys in a map with such keys, then modify one key to resemble the other, the map then contains duplicate keys. |
Example code |
key1: "foo" key2: "foobar" result: make map! reduce [key1 'key1 key2 'key2] append key1 "bar" probe result/:key2 result |
Assigned to | n/a | Fixed in | - | Last Update | 14-Mar-2014 19:04 |
---|
Comments | |
---|---|
(0004366)
BrianH 14-Mar-2014 19:04 |
Yup, that's bad. Map keys should be protected copies somehow, or at least marked as protected for now as a stopgap solution.
AFAIK in Ruby 2.1 their hash keys get frozen to prevent exactly this kind of thing. I'm not sure what the restrictions are in practice, or the real behavior model, but it might be worth looking into and emulating in some ways. They've been dealing with some of the same problems we have been. |
Date | User | Field | Action | Change |
---|---|---|---|---|
22-Jun-2014 07:19 | BrianH | Comment : 0004366 | Modified | - |
22-Jun-2014 07:18 | BrianH | Comment : 0004366 | Modified | - |
14-Mar-2014 19:04 | BrianH | Comment : 0004366 | Added | - |
14-Mar-2014 19:02 | BrianH | Code | Modified | - |
14-Mar-2014 19:02 | BrianH | Status | Modified | submitted => reviewed |
14-Mar-2014 19:02 | BrianH | Priority | Modified | normal => high |
12-Mar-2014 05:01 | rgchris | Ticket | Added | - |