Hi Yuriy,

I though the same. There is a similar situation with pluggable collections 
where you have to specify two blocks: one for the hash the other for equality.
So you have to repeat three times the property you're interested in:

PluggableSet new
        hashBlock: [ :each | each name hash ];
        equalBlock: [ :a :b | a name = b name ];
        yourself.

Where I would like to be able to write: 

PluggableSet by: #name.




On 11 mars 2014, at 09:19, Yuriy Tymchuk <yuriy.tymc...@me.com> wrote:

> Hi guys.
> 
> This is a thing that I encounter quite often.
> 
> Eg I have a collection of projects and I want to sort them by creation date. 
> It would be nice to be able to do something like:
> 
> projects sortByProp: #creationDate
> 
> or by birth date of the author
> 
> projects sortByProp: [ :proj | proj author birthDate ]
> 
> Maybe I’m wrong, but as I’ve told already I encounter it quite often and 
> writing something like
> 
> projects sortBy: [ :prev :next | prev creationDate <= next creationDate ]
> 
> is boring for me.
> 
> Cheers.
> Uko


Reply via email to