Ken Takata wrote:
[...]
> > I do think that the backslash (or any other special character that might
> > be available) makes it ugly.
> >
> > Although we can find the end of the expression without the "}", mistakes
> > will be very hard to figure out. Also reading back a lambda that's
> > passed as an agument to a function with many arguments will make the {}
> > part easy to spot. I have done this in Zimbu and I'm happy with how it
> > looks.
> >
> > I don't think it's hard to implement: When finding a "{" look forward,
> > skipping over [a-zA-Z0-9 ], if "->" is found it's a lambda.
>
> Here is an experimental patch:
>
> https://bitbucket.org/k_takata/vim-ktakata-mq/src/90ea467da862bc2eaf59454f75b8faea34604a1e/lambda2.patch?fileviewer=file-view-default
>
> * Support only one expression.
> * The "a:" prefix cannot be omitted.
> * No closures.
> * Inefficient "{" parser.
>
> Both mattn's patch and ZyX's code are partly used.
> Nested lambdas are also supported like ZyX's example:
>
> :echo {a -> {tmp -> [a:tmp, a:tmp + 2, a:tmp + 5]}(a:a * 5)}(2)
> [10, 12, 15]
>
> Hmm, it's hard to read.
Thanks for making the patch. I think at a high level it looks good.
Like I mentioned, I don't think we should require "a:arg", just "arg".
Perhaps in the function, instead of using a dict for local variables,
use the dict for arguments. After all, there are no local variables.
Seeing the documentation, and perhaps a few tests, may trigger some fine
tuning. So I hope you can do that.
--
Vi is clearly superior to emacs, since "vi" has only two characters
(and two keystrokes), while "emacs" has five. (Randy C. Ford)
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
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/d/optout.