On 2021/01/06 12:28, Salman Halim wrote:
> While I can't explain why things work the way they do, here is a
> custom function
---
That's just the thing -- the functions in Vim should be the most general
possible so custom solutions are rarely, if ever needed.
On 2021/01/06 13:16, Salman Halim wrote:
>
> Of course, if you have dozens and dozens of arguments, you could wrap
> them in a [] pair to convert it into a list of arbitrary length (that
> process isn't limited by the 20 function parameter limit).
> Programmatically speaking, if you're doing this dynamically, it seems
> to me as if creating a list of arbitrary length is better than
> creating an execute statement that takes a large number of individual
> parameters.
---
But non-programmatically, when you just want the min/max of 2, wouldn't
handling both cases be best? So other functions could pass large numbers of
parameters in a list, but simple cases wouldn't need the overhead or special
syntax.
If the function handled both cases min(3,4,5,[1,2]) would become
min(3,4,5,1,2) or min([3,4,5,1,2]) and either format would work. Then users
expecting simple like 'min(1,2)', would just have it work, while those
wanting more complex, could use the equivalent min([1,2]); Either way, it
would just "do the right thing" and not require the user to conform to one
one syntax or the other.
As you point out -- it can be done today -- it just hasn't been,
yet. :-)
--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/5FF67D00.1030209%40tlinx.org.
Wednesday, January 6, 2021
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment