[Pharo-project] could we agree to remove caseOf: and caseOf:otherwise:
Casimiro de Almeida Barreto
casimiro.barreto at gmail.com
Tue Feb 15 22:07:57 CET 2011
Em 15-02-2011 16:55, Schwab,Wilhelm K escreveu:
> I am not completely certain who is on which side here anymore, other than #caseOf: is at the center of it. I think I saw Eliot say that Cog uses it; if I got that right, it's a pretty compelling reason to keep it in the image. Doing that, either for Cog's benefit, or even just for the convenience of a subset of users does not necessarily imply that Pharo itself needs to use the message. That is about the limit of what I can offer in the form of guidance, and it is really more of a question: could Pharo be changed to ignore the message, and then keep it in the image for Cog and other users? Maybe that is too idealistic, or just plain naive :)
> Mapping integers from the outside world to objects and/or behavior is something that I do a lot. I have to more or less agree with Sig; case statements as such generally point to room for a design to better exploit messaging. There are indeed scenarios (especially if not exclusively in external interfacing) that call for mapping numbers to actions. I have had great results with dictionaries for that purpose, but I am not trying to squeeze every last byte code per second out of a portable VM.
Yeah, implementations using dictionaries are quite elegant. And they're
not usually expensive in terms of processing. Anyways, when processing
external input, IO is usually much slower than relating a numeric value
to a symbol & then performing an action...
There are lots of alternatives to performing a "caseOf:" thing, so I
just don't see things as a question of "smalltalk purity".
> There have been situations in which Smalltalkers have climbed the ivory tower and looked with contempt on things that make the world work. I am not convinced that is happening here.
More information about the Pharo-project