[squeak-dev] #cull: protocol
josh at schwa.ca
Sun Feb 21 18:46:14 UTC 2010
On Feb 21, 2010, at 10:17 AM, Nicolas Cellier wrote:
> 2010/2/21 Josh Gargus <josh at schwa.ca>:
>> (I'm not on the Pharo list; could someone who is cross-post this?)
>> I understand the purpose, but I think the name is horrible.
>> Even #value:value: is somewhat confusing, when you think about it. #value makes perfect sense, and #value: is a natural extension meaning "answer the value of the block with the given arg". But #value:value: makes it seem like the word "value" now refers to the arguments instead of the operation to be performed by the receiver. We have a sort of pun, where the word "value" is being used in two senses at once. Oh well, it's too late to change now, and I don't have a better suggestion anyway.
>> The message #cull: does not say what it means: "answer the value of the block with the given arg, but ignoring the arg if the block doesn't take that many arguments". There is little correspondence between the meaning of the word "cull" in English and the semantics of the invoked method. Sure, programmers can learn what it means, just like they can learn what "extern" means in C. The problem is that we're essentially adding a keyword to our language. Smalltalkers often brag, rightfully, about how few keywords there are in the language. We should avoid introducing what are essentially keywords into core protocols (they're actually worse than keywords, because at least keywords can be highlighted by a pretty-printer).
>> #valueWithPossibleArgs: is awkward, but at least the name has some relationship with what it means, plus people already know what it means. What about instead using the protocol #valueWithPossibleArg:, #valueWithPossibleArg:value:, etc. ?
> Horrible but compatible...
True. I didn't read the whole Pharo thread until right now. I assumed that this was a new Pharo protocol that we might be able to agree on a better name for. Now that I see it's an existing VisualWorks protocol, and I agree that it's better to be compatible.
More information about the Squeak-dev