SOMns
SOMns copied to clipboard
Object Literals break Value semantics
The current implementation of object literals is unfortunately not yet taking into account value semantics properly:
class Foo new: v = Value (
| public v = v. |
)()
public main: args = (
| d |
d:: objL Value ()( public getD = ( ^ d )).
Foo new: d.
'Hello World!' println.
)
The above example shows that the local variable d
can be captured, it is mutable, and Foo new:
doesn't signal a NotAValue
error, which it should.
@richard-roberts, this is something that should be fixed "at some point". Nothing urgent. Naming you here mostly since this is introduced by #112.