Yes, I would welcome such an extension! I wouldn't invent a new syntax, though, but just use the existing protocol
array copyFrom: 1 to: -2 Cheers, Adrian On Jun 7, 2010, at 13:47 , Niko Schwarz wrote: > Hi guys, > > Am I the only one who finds the ruby protocol for accessing > collections richer at times? In Smalltalk, if ary is an array, how do > I get ary without its last element? > > In Ruby, it's dead easy: ary[0..-2]. I can do that by heart after not > having done any serious Ruby in a long time. In Smalltalk, I have to > search through a long list of method names, because there are just so > many possible names for the method. > > The point is: would it be totally out of reach to try and get a more > concise and unified way to access sequenceable collections? > > I know I'm sort of asking for the slaughter of a holy cow: Smalltalk > only has telling and easy message names all over. Or wait, does it? > There's of course Class >> #methodName. And 2 @ 3 for points. > > Just to put something on the table, how about: > > (ary at: 1, -2) > > Or, without braces, if you don't mind the reversal: > > 1,-2 @ ary > > Or, consistent with current naming conventions: > > (ary from: 1 to: -2) > > Just my 2 cents, what do you think? > > > Niko > -- > http://scg.unibe.ch/staff/Schwarz > twitter.com/nes1983 > Tel: +41 076 235 8683 > > _______________________________________________ > Pharo-project mailing list > [email protected] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project _______________________________________________ Pharo-project mailing list [email protected] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
