Em 31/12/2009 15:52, Adrian Kuhn <[email protected]> escreveu: > > > > This brings to the forum an interesting debate! Clearly Levente's > > solution is the String redirection for Lukas' solution. > > Do this method eases programming for newcomers? Or it creates > > burden as presented in Stan's posting? > > AK is IIUC very knowledgeable of tools used in Squeak/Pharo and > > even though, had difficulty to find this particular method!! > Good point! > To replace parts of a string, I want to send a message to the > string not to the > regex. So without doubt, string should understand such a > messages. (I dont know to which posting of Stan you're referring > though).
OK, so the redirection of the messages to String makes sense. I would only gripe about the protocol it appears right now: *vb-regex is the _implementation_ of the method's functionality, but from a [programer] user POV it would be more likely to another one (perhaps "searching and replace"). > Also, I would expect short message names for common > operations. Alas none of > > #copyWithRegex:matchesReplacedWith: asRegex + > ##copy:replacingMatchesWith: copyReplaceAll:with: > is particular short. And to make things words, none of these shows > up when auto > completing #repl... because they all start with copy. Plus strings > are nested in such a deep hierarchy that reading all understood > messages won't scale. Alas, I normally stay away of these discussions because I'm intoxicated by other programming idioms (like sed/AWK/Perl/Python/Ruby) which uses a very compact syntax for these operations and are now a lingua franca. > Personally, I would love to have a #gsub:with: on String. It is > short and uses established vocabulary. Yes it would be an adaptation of the above idioms to Smalltalk. _______________________________________________ Pharo-project mailing list [email protected] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
