On Oct 17, 2011, at 1:17 PM, Levente Uzonyi wrote: > On Sun, 16 Oct 2011, Stéphane Ducasse wrote: > >> >> On Oct 16, 2011, at 10:33 PM, Nicolas Cellier wrote: >> >>> Ah, I see, this sound appealing. >>> But I would object this: (I'm speaking of do:, not only to:do:) >>> 1) what the last value mean for unordered collections? >>> 2) for a SequenceableCollection, the behavior is already >>> (someCollection inject: nil into: [:void :each | aBlock value: each]) >>> 3) returning the last value in all implementors of #do: would cost >>> complexification of code and possibly slow down (non clean blocks) >>> >>> Is it really useful? >> >> Not really I do not like the idea to rely on it. >> but in that case the code you be explicit >> >> #undefined/nil >> should be the last expression of the block. >> >> My point was: the semantics of a block is to return the last expression and >> we should be consistent with that. > > The block returns the last expression, but in this case a method returns > the value. Here's an example: > > (1 to: 10) collect: [ :each | each squared ]. > > You don't expect to get 100 as the result, do you? :)
indeed :) I will have to reread the problem my friend got. Now my brain is glued with a little flu and excel salaries wonderful planning. Stef
