Open aghassemi opened 9 years ago
there has been some discussion about this regarding the other observ-*
modules. if we go for an api change, this is possible. comments on the subject are welcome.
I am thinking it may make sense for map and struct be to different. I don't have an issue with observ-struct but for something that's a map, I am thinking the observed immutable value can just be an immutable map, with only a get(key) and values are not accessible as object properties. ES6 map works this way and potentially when ES6 map is more widely implemented, this can also use it to allow non-string keys as well.
I found it strange that I can not use 'delete' or other reserved words as keys to a map. I can see the technical reason behind this decision but it is causing hard to reproduce/debug runtime errors in situations where the map is used in a dynamic way. I got lucky that one of the words that I happened to load dynamically into map was 'delete' purely by chance otherwise I would not have caught this error and now my work around is to always prefix the keys just because of a few reserved keywords.
It would be really nice to allow arbitrary keys.