update
y = x with (foo = 2)
What's it compile to?
It's something like
var y = _.clone(x)
y.foo = 2
But only @ptol can answer
@zaoqi It uses cloneObject https://github.com/ptol/oczor/blob/master/libs/std/ff.pre.js and then update foo property.
var y = oc.cloneObject(x)
y.foo = 2
It's slow.
Yes, we really need a real persistent map (in the sense of https://en.wikipedia.org/wiki/Persistent_data_structure). The current solution is a sort of a compromise between code simplicity, semantics, performance and generating more or less idiomatic js. This means there is no solution that will satisfy all four.
For example, a mutable STRef-based map (in Haskell sense) has a perfect semantics, preformance and it's possible to get idiomatic JS, but it's pretty ugly on Oczor side (and we don't have rank-2 polymorphism either)
@zaoqi Yes, by default for objects Oczor use basic mutable maps from the target language. Other data structure could be used for better performance.