Hey guys, I was discussing about methods like that with Marcus:
MyClass>>foo #(false) first ifFalse: [ 'first call since compilation' logCr. #(false) at: 1 put: true ] ifTrue: [ 'other calls' logCr ] DoIt: 4 timesRepeat: [MyClass new foo ] Transcript: 'first call since compilation' 'other calls' 'other calls' 'other calls' In the sista image/VM, we are most probably going with Eliot to implement a slow path when you edit the literal of a method (deoptimizing the method) so we can consider that the literals are immutable in the generic case (and if it's not true, execution falls back to a slow path). But I was thinking, does it worth it to implement the slow path ? Couldn't we just put literals as immutable all the time ? The methods as the one shown before would not work any more. But does someone use it ? ...
