define :person [
init: constructor [
name :string
surname :string
]
check: method [][
inspect this
]
]
define :personWrapper [
init: method [n, s][
\pers: to :person @[n, s]
]
doSth: method [][
\pers\check
]
]
a: to :personWrapper ["John" "Doe"]!
a\doSth
b: to :personWrapper ["Jane" "Doe"]!
b\doSth
leads to this:
[ :person
name : John :string
surname : Doe :string
]
[ :person
name : John :string
surname : Doe :string
]
The cause is that this\pers inside doSth has already been embedded the first time the function was evaluated. And since - for performance reasons - we tend to store evaluated blocks (apparently, a bit too much), the next time this function is called, with a different object, the same one is getting served π€¦π»ββοΈ .
So, let's fix it!
Type of change
[x] Bug fix (non-breaking change which fixes an issue)
Description
Right now, this:
leads to this:
The cause is that
this\pers
insidedoSth
has already been embedded the first time the function was evaluated. And since - for performance reasons - we tend to store evaluated blocks (apparently, a bit too much), the next time this function is called, with a different object, the same one is getting served π€¦π»ββοΈ .So, let's fix it!
Type of change