[Pharo-project] Why we have Behavior >> flushCache?
philippe.marschall at netcetera.ch
Thu Apr 28 12:04:31 CEST 2011
On 04/26/2011 12:34 PM, Mariano Martinez Peck wrote:
> Hi. As far as I can see,
> Behavior >> flushCache
> "Tell the interpreter to remove the contents of its method lookup
> cache, if it has
> one. Essential. See Object documentation whatIsAPrimitive."
> <primitive: 89>
> self primitiveFailed
> And primitive 89 does nothing in particular with the receiver (the class
> in this case). In both, InterpreterVM and Cog, the WHOLE cache is
> flushed, there is NOTHING related to the receiver class. Of course,
> that's at least what it looks for me (please tell me if I am wrong).
> So...if this is the case, wouldn't make sense to move it elsewhere?
I don't see it so hard. When the method answers the cache of the
receiving behavior is flushed. Sure the implementation is "naïve" in
that it does more work than required but it satisfies the contract. Once
you have a "better" implementation in the VM you don't need to change
any code just because your VM got better. You don't need to write any
detection code that checks what kind of VM you have.
More information about the Pharo-project