I prefer execute :) because evaluate looks like you don't run fast and generate possibly assembly on the fly. I stopped long time ago to use evaluate because people also think that Smalltalk is slow because of that evaluation.... silly idiots but they are out there.
Stef (Ze mass educator) On Aug 17, 2011, at 10:29 PM, Igor Stasenko wrote: > execute or evaluate? > > > On 17 August 2011 23:17, Stéphane Ducasse <[email protected]> wrote: >> I wrote >> >> >> cull: anArg >> "Execute the receiver with one or zero argument. >> >> [ 1 + 2 ] cull: 5 >> returns 3 >> [ :x | 1+ 2 + x] cull: 5 >> returns 8 >> " >> ^numArgs = 0 >> ifTrue: [self value] >> ifFalse: [self value: anArg] >> >> >> >> cull: firstArg cull: secondArg >> "Execute the receiver with two or less arguments. >> >> [ 1 + 2 ] cull: 5 cull: 6 >> returns 3 >> [ :x | 1+ 2 + x] cull: 5 >> returns 8 >> [ :x | 1+ 2 + x] cull: 5 cull: 3 >> returns 8 >> [ :x : y | 1+ y + x] cull: 5 cull: 2 >> returns 8 >> " >> ^numArgs < 2 >> ifTrue: [self cull: firstArg] >> ifFalse: [self value: firstArg value: secondArg] >> >> >> cull: firstArg cull: secondArg cull: thirdArg >> "Execute the receiver with three or less arguments. Check cull:cull: >> for examples" >> >> ^numArgs < 3 >> ifTrue: [self cull: firstArg cull: secondArg] >> ifFalse: [self value: firstArg value: secondArg value: >> thirdArg] >> >> >> cull: firstArg cull: secondArg cull: thirdArg cull: fourthArg >> "Execute the receiver with four or less arguments. Check cull:cull: >> for examples" >> ^numArgs < 4 >> ifTrue: [self cull: firstArg cull: secondArg cull: thirdArg] >> ifFalse: [self value: firstArg value: secondArg value: >> thirdArg value: fourthArg] >> >> Will add a bug entry >> >> Stef >> > > > > -- > Best regards, > Igor Stasenko AKA sig.
