пятница, 31 мая 2013 г., 17:14:17 UTC+4 пользователь mattn написал:
> Hi all.
> 
> filter() or map() is given {string} expression to compare the items. But 
> sort() is given function name or funcref for that.
> I hope to give expression to {func}.
> 
> I guess this is useful to call sort().
> 
> :echo sort([{"foo":3},{"foo":2},{"foo":4}], "v:lhs.foo - v:rhs.foo")
> [{'foo': 2}, {'foo': 3}, {'foo': 4}]
> 
> Below is a patch. Please check and include.
> This patch still allow to give string for function name.
> 
> https://gist.github.com/mattn/5684747
> 
> Thanks.
> - Yasuhiro Matsumoto

I would prefer a patch for adding support for funcrefs in map/filter instead.

And it is also bad idea to only overload strings: if you need expressions here 
use special value (like "expr") in place of {dict}, add second optional 
argument or whatever, but **do not silently allow invalid function names taking 
them as expression**. There already is a lot of places where vim shows strange 
behavior with otherwise invalid input, don't add yet another one.

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Raspunde prin e-mail lui