David Given wrote: > Mike Anderson wrote: > [...] > >>I was warming to the first one. It looks like you're sending a block as >>a message, which is odd, but not too odd. To think of a method body as a >>block is very natural. Unfortunately, I've realized that it gives you no >>opportunity to name the parameters. I suppose you could have: > > > I may be missing something, but given that blocks *do* have named parameters, > and that you can figure out how many parameters a message has from looking at > the name, is there anything wrong with: > > String addMethod: #join: doing: [ :aCollectionOfStrings | > ...code here... > ]. > > and: > > String addMethod: #replace:with: doing: [ :source :dest | > ...code here... > ]. > > Admittedly, this doesn't give you the traditional "replace: source with: dest" > syntax, but it does avoid having to invent anything too alien.
You're quite right, but I think that that declaration is no more readable than a C function signature, whereas the traditional Smalltalk signature is much more readable. Also, with the entire method definition in square brackets, it looks the same as the contents of a method browser in any other Smalltalk, examples in books, etc. Regards, Mike _______________________________________________ help-smalltalk mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-smalltalk
