Hi.
I think it would be a good idea to remove the self sends from any fix, and replace
self someInstanceVariablePlainAccessorMethodNamedTheSame
with
theInstanceVariableItself.
Because then you start adding message sends and that is time expensive.
Andres.
PLEASE DO NOT FOLLOW THIS ADVICE!
This makes code *much* less reusable, readable, and malleable. Part of the whole point of OO programming is to make state look like behavior. If the speed hit of instance variable accessing is significant, you should either use a VM that optimizes them away, or translate more of your methods to C.
(...flame off)
stp
Andres Valloud wrote:
Hi.
I think it would be a good idea to remove the self sends from any fix, and replace
self someInstanceVariablePlainAccessorMethodNamedTheSame
with
theInstanceVariableItself.
Because then you start adding message sends and that is time expensive.
Andres.
Hi.
PLEASE DO NOT FOLLOW THIS ADVICE! [OR YOU WILL DIE! :)]
Ok, ok... and I had taken special care to include the word Plain in the accessor message so it would be understood that the underlying method would just do ^someVariable, but ok...
.... let's add accessors for ALL classes. Andres.
But then you can't intercept and override the meaning of the name...
Cheers,
Alan
------
At 1:47 PM -0800 7/30/99, Andres Valloud wrote:
Hi.
I think it would be a good idea to remove the self sends from any fix, and replace
self someInstanceVariablePlainAccessorMethodNamedTheSame
with
theInstanceVariableItself.
Because then you start adding message sends and that is time expensive.
Andres.
Hi.
Alan Kay wrote:
But then you can't intercept and override the meaning of the name...
Interval methods don't even use accessors... I don't understand a millicent :(. For instance:
do: aBlock
| aValue | aValue _ start. step < 0 ifTrue: [[stop <= aValue] whileTrue: [aBlock value: aValue. aValue _ aValue + step]] ifFalse: [[stop >= aValue] whileTrue: [aBlock value: aValue. aValue _ aValue + step]]
I do not see any accessor there. Andres.
squeak-dev@lists.squeakfoundation.org