This has to be expanded. No doubt it needs to be done, but this statement is too broad.
> - introducing threading (python, ruby ctrl-c does not work)
Ctrl-C is not as much an issue as thread unsafety when it comes to threads.
I guess you will have to start with removing globals scattered over all files. This part can be iterative (a few globals per patch assuming we are not forking and have permission from Bram) and is relatively simple at start.
I was thinking about starting a new series of patches with sole purpose of removing globals, but without a) experience in C multithreading (i.e. knowledge of what ultimate goal requires me to do) and b) permission from Bram or some will to do a job of convincing him (with a) badly hitting my positions) I cannot start it.
> - have your whatever beloved interpreter as standard interpreter
No much sense. VimL is better with its :s/:g/:... commands for quickly writing something simple for text processing. Having command like :pyrepl to run python REPL (and same for other interpreters) would be handy to quickly writing something relatively complex though.
Making some interpreter standard not only risks slowing user down, but also makes it close to impossible to use other people's vim.
> - add js support (v8)
This has to be a low priority, especially considering v8: Gentoo maintainers have masked it for removal as it "does not have stable API resulting in compile breakages in reverse dependencies". There is no way you can refactor vim and fight with this at the same time, and I guess not only Gentoo maintainers will not be willing to deal with it.
Especially considering that there are no plugins written in javascript for an obvious reason and javascript is not the best language you can pick for embedding.
> - compare with Yzis
> - think about whether gobjectIntrospection interface can be used to
> share work on interfacing with interpreters in the future.
> - maybe introducing a new higher level language which is friendly to C
> and less complex than C++ - yes, sry - I consider C to be a problem
> because its hard to share code, eg reuse the syntax highlighting from
> within JS and so on.
I would consider D in first place. Not that I actually worked with it, but I have read lots of articles convincing me that it is way better then C++.
There are other concerns though: C is portable (with lots of macros, but they are primary isolated), there is a way to use a C function from nearly anywhere (e.g. like with python ctypes, etc), there is a big bunch of things that have C bindings and sometimes are even written in C and it does not forbid any optimization you may come up with.
I do not understand the statement about reusing syntax highlighting though: you either write in JS, something that compiles to it (C *does*) or forget about the idea AFAIK (assuming you are talking about browser js).
I would suggest limiting options to only languages that work on all kernel+architecture combinations debian works.
> - ..
>
> Of course if you think "vim is great the way it is" (I agree)
> and if you think "nothing should be changed" I tend to disagree.
>
> If you don't receive much feedback I'll try the kickstarter project
> adding features I think are most useful to start with.
>
> Marc Weber
>
> --
> --
> 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+u...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
On Nov 25, 2013 9:23 PM, "Marc Weber" <marco-...@gmx.de> wrote:
>
> > Making some interpreter standard not only risks slowing user down, but also
> > makes it close to impossible to use other people's vim.
> Well - that's already the case - and I don't care. People remap :; in
> normal mode only (to reduce stress) and the like.
I mainly omit mappings changing core commands behavior too much from the original. It does not mean there are no mappings I am too used to. What you suggest is very different: start with vim -u NORC and you get no mappings and trapped in a language you are not familiar with. More, unlike VimL there is exactly no requirement on having other languages. Thus if with vim I can use my own vimrc or, at least, input some mappings by hand, what can I do if there is and *may be no* python? Not all interpreters work on the same OS+arch combination vim does.
> But starting up Vim is fast, adding conditional code in ~/.vimrc
> like if $VIM_CONFIG == "me" ... seems to be reasonable.
>
> VAM/vundle/pathogen support having plugins in directories. So this
> is no problem at all.
>
> > There are other concerns though: C is portable (with lots of macros, but
> > they are primary isolated), there is a way to use a C function from nearly
> > anywhere (e.g. like with python ctypes, etc), there is a big bunch of
> > things that have C bindings and sometimes are even written in C and it does
> > not forbid any optimization you may come up with.
> That's why I want something "D/Haskell/disciple/urweb" like which can
> compile down to C, and which knows about "things close to C" so that you
> can replace pieces only without having to rewrite all code at once.
> And that language does not exist yet to my knowledge.
Bram is creating some language which may or may not fit, do not remember the details right now though.
On Nov 25, 2013 10:20 PM, "Marc Weber" <marco-...@gmx.de> wrote:
>
> Excerpts from Nikolay Pavlov's message of Mon Nov 25 18:55:56 +0100 2013:
> > I do if there is and *may be no* python? Not all interpreters work on the
> > same OS+arch combination vim does.
> Then there will be no support - why bother?
> Then Vim will be "an editor only" on those platforms. But honestly I
> think moste people do use Vim on systems where most interpreters (like
> python) are available, too.
>
> Also pay attention that Vim already is a set of compromises.
>
> Example 1:
> if_ implementations seem to support therading (scheme), others
> don't or don't do that well such as python. It works, but never call
> back into Vim from a background Vim thread ..
Do not know about mzscheme (racket), but if_py does not actually support threading: it is cpython that supports it: you are forced to bother with GIL. Though releasing it temporary to work with some vim C functions is not required I can hardly call these bits support.
> Example 2: Mappings. In gvim some mappings are available which are not
> in vim <m-*>
>
> Yet nobody asked "what about console? Some mappings will not be
> available".
>
> If something is not implemented (such as rm -fr), you have to worry
> about it in VimL- and VimL might be bad at it.
There is a big difference between one mapping disabled and missing support for the whole language with a day-to-day use. If one has to know VimL because it is the only option he will survive such situation. If one has not and thus do not know VimL a tiny bit...
And you still have not addressed another part: how will you spell things like :?abc?,/def/s/a/b/i or :g/ghi/norm A$ with python considering it is the default? I do not know a good solution. VimL is good unless you want to write a script with this. Python is very good for scripts, but never try to write a one-liner with it. Perl is good for one-liners as well as the scripts, but it is good for one-liners working with *streams* (e.g. pipes or files) (though there are interesting things like if(/abc/../def/), they are not much helpful if there are multiple lines matching /abc/ above the cursor and you only need the closest one).
>
> > Bram is creating some language which may or may not fit, do not remember
> > the details right now though.
> http://www.zimbu.org/
>
> zimbu is about "everything is an object" and everything "has an
> interface". While that's nice it prevents some kind of optimizations.
> Some existing systems tend to either "allow optimizing everything" or
> "nothing". The perfect system does not "write code", it describes code
> which can than be transformed into whatever you need.
> For the OO part I agree much with zimbu, however I'd also like to see a
> functional/haskell/ocaml like part: everything is data, and at compile
> time the compiler chooses the right code to operate on it using type
> classes. If you don't have inheritance the difference should not be that
> big.
>
> Marc Weber
>
On Nov 26, 2013 6:14 AM, "Marc Weber" <marco-...@gmx.de> wrote:
>
> Excerpts from Nikolay Pavlov's message of Mon Nov 25 19:46:51 +0100 2013:
> > Do not know about mzscheme (racket), but if_py does not actually support
> > threading: it is cpython that supports it:
> The problem is that Vim does not expect called by Vim unless its VimL
> calling into Vim or such. Python does support passing CPU to multiple
> python threads.
> But if such thread wants to tell vim "hey, i'm ready", it cannot be done
> easily. You have to put the thread into "waiting/ready state", then you
> have to make Vim poll for that state. Otherwise Vim might crash.
> And that polling is hard to implement without delay. I know about on
> idel events and such, but then you might collide with other plugins.
> So whatever you do its a hack only.
>
> > And you still have not addressed another part: how will you spell things
> > like :?abc?,/def/s/a/b/i or :g/ghi/norm A$ with python considering it is
>
> Let's say it this way:
> :%s/* are just "viml commands"
> Thus ":%s/" would no exist if you changed default interpreter.
> Eg let's assume you'd choose python as default, then you would have to:
> :vim.eval('%....')
> or wirte a substitute function in python in global scope.
Function is going to be verbose. And what is the point in picking default interpreter if you have to use VimL in such a weird way?
Also note that you cannot use python re without joining buffer into one big string and then splitting. Guess the same with other interpreters.
> q: /: ?: already show how you can have multiple "mini buffers" for
> different tasks. So why not have a p: or a v: to get python/viml command
> lines ? (I know p is paste ..)
I already said that having command like :pyrepl may be handy: there even exist some plugins for this task. No need to take any keys for this though.
Rather than a slightly improved version of vim, I'd like to see a free version of vim for eclipse that is able to run any vim plugin and fully integrates with eclipse (though eclim already is great) and/or a browser/web based version of vim that runs any vim plugin and that works with the local file system or files on some server.
Just my 2c :-)
I agree. Then let us fix it.
>
> Join by providing feedback:
>
> http://mawercer.de/vim.php
>
I want to join, but I receive the following message when I try:
Forbidden
You don't have permission to access /x/php.fcgi/index.php on this server.
>
> or adding additional issues to be fixed here:
>
> http://vim-wiki.mawercer.de/wiki/topic/in-which-way-does-vim-suck.html
>
I receive the above message when I try to access this link too.
Please, let me know what can I do for joining. Let me be clear in what ways I can help. I am a reasonable programmer. I worked as a programmer at Cornell University (this was a long time ago ... :-). Recently, I worked at Utah State University as a programmer (well, my title was Visiting Professor, but what I did was programming). Finally, I helped lawyers in creating databases, textual search, syntactic analyzers for legal texts, communication programs to access higher courts, etc. As for languages, my experience are: Pascal, Visual Prolog, Haskell, C, Clean, Lisp, Ocaml, Scheme.
A suggestion: Write a small starting point in the language of your choice, and post it in your page. This starting point should include cursor movements, erase operations, saving operations, clipboard operations, parentheses matching, and a primitive syntax highlighting scheme. You could invite people to post this kind of editor kernel in your page too. Use ncurses for the kernel. I am talking about a couple of hours of work.
Based on this kernel, people involved could have a better base for choosing the language. I even don't discard implementations in many languages. For instance, if a group wants to write an Ocaml version, let them do it.
Please, fix the links so I can visit your pages.
> The idea is to create a kickstarter project to funding all work.
>
> IMHO Vim is worth keeping alive, and that means we must find a way
>
> to move Vim into the future.
>
>
>
> If this requires writing a new language, because C lacks abstracktions,
>
> and C++ is complex, then that's the task to be done IMHO.
>
>
>
> This project makes me think we might have success:
>
> http://www.kickstarter.com/projects/maxcantor/beautiful-vim-cheat-sheet-poster?ref=live
>
>
>
> Thus if you're either a developper or a user who wants to help join and
>
> tell me what you want to work on - even if its "testing new features you
>
> care about" only.
>
>
>
> Goals are:
>
> - focus on productivity
>
> - code reusage
>
>
>
> I consider refactoring viml a key thing, eg creating a viml library
>
> which contains the interpreter only.
>
>
>
> If you'll help me with this I'll be working on Vim related topics the
>
> following month, otherwise I'll get any alternative job.
>
>
>
> I feel I've hit a border meaning some core items must be fixed in order
>
> to improve even further, and most people cannot afford dropping out of
>
> job and work 8 weeks on Vim.
>
>
>
> The work will be
>
> - defining goals
>
> - fixing them
>
>
>
> This work might end
>
> - in rewriting huge parts
>
> - introducing threading (python, ruby ctrl-c does not work)
>
> - have your whatever beloved interpreter as standard interpreter
>
> - add js support (v8)
>
> - compare with Yzis
>
> - think about whether gobjectIntrospection interface can be used to
>
> share work on interfacing with interpreters in the future.
>
> - maybe introducing a new higher level language which is friendly to C
>
> and less complex than C++ - yes, sry - I consider C to be a problem
>
> because its hard to share code, eg reuse the syntax highlighting from
>
> within JS and so on.
>
> - ..
>
>
>
> Of course if you think "vim is great the way it is" (I agree)
>
> and if you think "nothing should be changed" I tend to disagree.
>
>
>
> If you don't receive much feedback I'll try the kickstarter project
>
> adding features I think are most useful to start with.
>
>
>
> Marc Weber
On Dec 2, 2013 9:25 AM, "Marc Weber" <marco-...@gmx.de> wrote:
>
> Excerpts from Ed Kostas's message of Sun Dec 01 16:01:42 +0100 2013:
> > I want to join, but I receive the following message when I try:
> > You don't have permission to access /x/php.fcgi/index.php on this server.
> Your message to the mailinglist has been enough, I took notes.
>
> The pages will be back soon, I've problem with php-fpm access rights for
> some wired reasons after trying an update.
>
> > > http://vim-wiki.mawercer.de/wiki/topic/in-which-way-does-vim-suck.html
> > I receive the above message when I try to access this link too.
>
> You can read the source @ github, too:
> https://github.com/MarcWeber/vim-git-wiki/blob/master/vim-online-wiki-source/topic/in-which-way-does-vim-suck
>
> I think the first important thing is to collect things to fix, then
> workout how to fix [1] them, then estimate costs and try to get funding.
I think that the most problematic thing to fix is threading. You cannot add thread safety without a very huge rework that starts with removing global state (unless we are going to say that GIL is good enough). And it will be problematic to add other changes while refactoring is in progress.
From my point of view this list should look like this:
- Threading.
- Making vim embeddable (making it second point since it is even more refactoring).
- Input (I mean this constantly popping out discussion with vim not supporting certain keys).
- More input (iminsert and keymaps are not good at all at handling people using more then one keyboard layout: gvim needs a way to get actual keys pressed and process them as if they were user English layout (not hardcoded us keymap) regardless of actual layout when not in insert or command(?) modes).
- Stripping requirement to use VimL in Python/Ruby/Lua/etc interface. I.e. finishing what I started (I guess I can do this) for python and doing the similar thing for other languages.
- Zero byte handling. Low priority since this is uncommon to have in text files, but in the current state you have to write ugly hacks to make it work. Should probably be the third as it implies refactoring string implementation. Possible solutions I see: escaping like in zsh (note that it is done the way you never notice) or struct {size_t len; char str[1];} (where you allocate string using usual alloc(sizeof(str_T) + len) hack).
- Unicode support in regular expressions.
- Possibly sane unicode indexing (may require further string refactoring to be efficient).
- Non-string funcrefs (i.e. inclusion of my patch (without lambda part)). It contains fixes for some problems.
- Stripping requirement to use shell to run applications.
> Thanks for your interest.
>
> Marc Weber
>
> [1]: And I don't know this yet. This will take some time.
>
On Dec 2, 2013 5:25 PM, "Marc Weber" <marco-...@gmx.de> wrote:
>
> Hi Nikolay
>
> I've turned your suggestion into a page about order of steps to fix Vim:
> http://vim-wiki.mawercer.de/wiki/vim-development/fixing-vim-next-steps.html
>
> Have a look at the (Comment ..) text, please add some samples. Code can
> be added by
> {{{
> ...
> }}}
> I've also added you as collaborator to https://github.com/MarcWeber/vim-git-wiki.
> See http://vim-wiki.mawercer.de/wiki/this-wiki/contributing.html
>
> Duplicating my comments here so that items can be discussed.
> (If you reply here I'll just update the comments)
>
> Excerpts from Nikolay Pavlov's message of Mon Dec 02 08:41:43 +0100 2013:
> > - Making vim embeddable (making it second point since it is even more
> > refactoring).
> Keep in mind that Yzis team failed on this, see
> http://www.freehackers.org/VimIntegration (which was posted in this
> thread earlier)
>
> > - Stripping requirement to use VimL in Python/Ruby/Lua/etc interface. I.e.
> > finishing what I started (I guess I can do this) for python and doing the
> > similar thing for other languages.
> I don't get you, can you elaborate?
Currently such interfaces are pretty much useless without using vim.eval or vim.command (or equivalents in your language of choice). I started creating wrappers around various C structures (like that vim.options thingie wrapping functions that manipulate options array) that strip out requirement for vim.eval/vim.command.
> > - Unicode support in regular expressions.
> Can you also provide a simple use case, here ?
How do you match a Russian word? This will be /\b\p{Cyrillic}+\b/ in Perl. There is a big bunch of Unicode properties that you can place inside figure braces there and they are there for a reason. The most severe are more general groups: e.g. what is the regex for matching variable name in python 3 (ignore reserved words for simplicity)? Hint: it is not \<\a\w*\>: Python 3 supports using non-ASCII in variable names.
>
> > - Possibly sane unicode indexing (may require further string refactoring to
> > be efficient).
> Use case ?
You are at the column N and want to get character before the cursor to decide the behavior of Tab. Assuming you are writing text in LaTeX in Russian and want to detect whether it is Russian letter just before the cursor to do something special. The best idea would be using indexing, but it is wrong, so you have to use matchstr(). matchstr(getline('.')[:col('.')-2], '.$') vs getline('.')[col('.')-2].
This can be worked around, but workarounds are ugly. And there is big bunch of plugin developers who do not care about unicode and thus do not have such workarounds (consider the relatively recent issue where one Russian man wanted to use IMAP() to map some Russian letters and was unable to for this very reason). Good language is not about "care about things or they will not work". It is about "you see how many things work without you actually caring about them".
I have yet to see a language which is not going to bother me with encoding issues.
>
> > - Non-string funcrefs (i.e. inclusion of my patch (without lambda part)).
> > It contains fixes for some problems.
> Again, just add a section to http://vim-wiki.mawercer.de/wiki/topic/in-which-way-does-vim-suck.html
>
> > - Stripping requirement to use shell to run applications.
> Again, a use case would help much understanding what you mean exactly.
system("frobnicate ".shellescape(@%)) vs system(['frobnicate', @%]). It is again very easy and common to forget about escaping or do it wrong. But it is even easier to have your plugin screwed up just because vim has no way other then passing argument to cmd.exe with clumsy escaping. Check python subprocess module to see how to do it right.
---
Also using pipes and not temporary files is faster and sometimes more reliable. It has to be a separate issue I have not mentioned.
>
> Marc Weber
On Dec 2, 2013 6:28 PM, "Mikołaj Machowski" <mik...@wp.pl> wrote:
>
> Dnia Poniedziałek, 2 Grudnia 2013 14:25 Marc Weber <marco-...@gmx.de> napisał(a)
> >
> > Excerpts from Nikolay Pavlov's message of Mon Dec 02 08:41:43 +0100 2013:
> > > - Making vim embeddable (making it second point since it is even more
> > > refactoring).
> > Keep in mind that Yzis team failed on this, see
> > http://www.freehackers.org/VimIntegration (which was posted in this
> > thread earlier)
>
> Yzis failed mainly because it was ugly hack around Qt event loop which meant (among others) it was sloooooow. Since then Qt evolved and building and maintenance of 'qvim' should be much easier.
>
> > > - Unicode support in regular expressions.
> > Can you also provide a simple use case, here ?
>
> Just guessing: [a-z] automatically cover national diacritics without need to list them separately eg [a-ząęćżźół] (this case would be covered by [:alpha:] but it is simplest example of usage)
>
> > > - Possibly sane unicode indexing (may require further string refactoring to
> > > be efficient).
> > Use case ?
>
> Vim doesn't recognize how many bytes are in character and indexing of strings may broke easily which is awkward: Vim is *text* editor and should deal with characters not bytes.
>
> > > - Stripping requirement to use shell to run applications.
> > Again, a use case would help much understanding what you mean exactly.
>
> Wouldn't proper threading take care about that problem?
Which problem? Process is run using C functions like execve. How vim runs system('command')? It runs execve("/bin/zsh", {"/bin/zsh", "-c", "(command) >/tmp/... 2&>1"}, env) (checked out with strace). You see: while one can call command directly it is calling shell and it calls the command. This has nothing to do with threading, it is more about efficiency (which is even worse then you imagine as some users prefer to use interactive versions of shell just to be able to use their aliases) and escaping (I was thinking about python subprocess-like first argument handling in system(): it takes lists as this argument and either escapes it (no other way on windows) for the program (not for the *shell*) or constructs execve call with this list transformed into array of strings).
>
> m.
I do not think making PCRE work with vim buffer representation is easier. In fact, I think the opposite. Not to mention that you need make it work with buffers representation and additionally support vim-specific stuff like \%V.
> /bpj
On Dec 2, 2013 8:44 PM, "Marc Weber" <marco-...@gmx.de> wrote:
>
> Excerpts from Nikolay Pavlov's message of Mon Dec 02 15:56:25 +0100 2013:
> > Currently such interfaces are pretty much useless without using vim.eval or
> > vim.command (or equivalents in your language of choice). I started creating
> > wrappers around various C structures (like that vim.options thingie
> > wrapping functions that manipulate options array) that strip out
> > requirement for vim.eval/vim.command.
> => TODO: would gobjectIntrospection system help? AFAIK it can generate
> beindings to gobject like interfaces automatically for most scripting
> languages
Wondering whether gobject may make python-vim API look like rather regular python module and not like something ctypes-based with many implementation details leaking.
>
> > > > - Unicode support in regular expressions.
> > > Can you also provide a simple use case, here ?
> > How do you match a Russian word? This will be /\b\p{Cyrillic}+\b/ in Perl.
> So what you're aksing for is [a-zA-Z] but include language specific
> characters such as ß in German or whatever is used in Russia?
> Something smarter than [^ \t.;:!"'] (trying to match non word chars ..
> but that's not going to work well)
It is locale and not unicode support, though they intersect. I understand that locale support will break plugins, thus I asked only about unicode. This is not about ranges, but about character properties.
>
> > PCRE:
> In fact that was what I proposed to Bram, I even wrote to the PCRE
> mailinglist to understand how to use it (feed data in incrementally).
> Bram disliked the idea ..
> I'm in favour of "reusing code" if possible. I'm not in favour of
> maintaining everything myself.
I do not remember clearly, but was not it suggested to take PCRE syntax? I do not remember any discussions suggesting taking PCRE and replacing parser code, but I may have missed something.
>
> Also they were refactoring the interface.
>
> Well "just improve" is not enough. We have one use case {Cyrillic}, but
> which additional ones to support?
All unicode properties. I guess you may use icu to fetch characters with a given property into a collection. Maybe existing API allows faster variants.
It is useful for things like stripping diacritics or finding variable names. There are more uses I cannot imagine thus there is no need for restricting support to just some unicode properties unless there is some technical reason for it.
>
> > > > - Non-string funcrefs (i.e. inclusion of my patch (without lambda
> > part)).
> Oh by the way: I introduced kind of, see vim-addon-mw-utils
> funcref#Function or such. It allows storing a function to be called and
> some args to be passed first. It also allows to evaluate strings.
>
> Its not perfect, but quite useful.
It is not this. Problems solved include:
- Possible deletion of function that is referenced somewhere.
- Weird anonymous function names.
- Restriction for deleting functions being profiled.
- Using python callables as vim functions.
This list does *not* include partial application, not without lambda subbranch.
>
> > system("frobnicate ".shellescape(@%)) vs system(['frobnicate', @%])
> Have a look at VAM's shell dsl. it comes very close.
I know it. It is not close, not a tiny bit. Main problem is not escaping, it is shell itself. There is no way you can use system()/:! and not use shell.
>
> > again very easy and common to forget about escaping or do it wrong
> I agree. Also system vs :! requires different quoting etc.
>
> > Also using pipes and not temporary files is faster and sometimes more
> > reliable.
> r! ...
> :cbuffer
> :-)
It is too smart about line endings.
> Added this to the sucks page
>
> Marc Weber
>
I'm sure fixing this would have destabilizing ripple effects on all plugins, but we are trying to "enhance" ViM =)
On Dec 2, 2013 10:41 PM, "Marc Weber" <marco-...@gmx.de> wrote:
>
> Excerpts from Nikolay Pavlov's message of Mon Dec 02 18:12:00 +0100 2013:
> > Wondering whether gobject may make python-vim API look like rather regular
> > python module and not like something ctypes-based with many implementation
> > details leaking.
> Writing a small python layer on top should be easy.
>
> > I do not remember clearly, but was not it suggested to take PCRE syntax? I
> > do not remember any discussions suggesting taking PCRE and replacing parser
> > code, but I may have missed something.
> I don't remember wether it was public. Facts: PCRE is fast, it already
> implements what Bram had in mind, it even has JIT support.
> But yes, it would be PCRE syntax, too. (Is this good or bad?).
It is bad. Everybody is using vim syntax and thus PCRE one is not acceptable for it throwing away backwards compatibility with exactly no nice ways to work around.
>
> > All unicode properties.
> Add references to documentation what you have in mind (wiki).
Unicode property is an already defined entity. Maybe need a link (though do not know where to as perldoc perlre and some icu examples assume you know what exactly "unicode property" is).
>
> > It is not this. Problems solved include:
> > - Possible deletion of function that is referenced somewhere.
> What for? Don't understand what you mean.
You can define a function, reference it and do :delfunction. Now reference is unusable. My branch holds a reference to function definition in funcref variable so that as far as you hold the reference you are guaranteed to run exactly the same function you referenced.
Note: this means that if there is reference somewhere when you redefine function that reference will still use old definition. I consider such stability an advantage.
>
> > - Weird anonymous function names.
> Talking about dictionaries? :function{23} will provide more information
Which is very inconvenient. And it does not provide a name. I am losing the ability to use :fu without holding a reference in that branch, but it is possible to have :fu working with the error output and have normal function names at one time with a more or less minor patch, but I like current state much more since it a) is less damaging to debugging then numeric names are (too easy to workaround and trying to use :fu in the only case I actually *may* have preferred it over browsing source code (long generated functions) is very inconvenient without syntax highlighting (do not recommend :redir to a file and then opening it: it is far less convenient then what I have)) and b) makes anonymous functions not global.
>
> > - Restriction for deleting functions being profiled.
> > - Using python callables as vim functions.
> You can do this all - kind of.:
>
> You can define helper function
>
> fun! CallPyAndReturn(py-expr)
> py a = a:py-expr
> py return a
> endf
>
> Then
>
> let my_funcref = funcref#Function('return CallPyAndReturn('python-thing', ARGS[0], ARGS[1])', [2])
> # my_funcref contains first arg. Second arg still has to be passed:
> let x= funcref#Call(my_funcref, [arg_2])
Make this a) automatic b) automatic and fast and c) make it friends with GC so that you cannot dispose python object when you hold a reference and you will dispose it when you don't.
And your code is not going to work. There are way too many mistakes for such small piece of code. I do not even get an idea, so I am pretending the idea behind this code is the same as I would have written: store python callable into a dictionary, generate an anonymous function which calls it with "*vim.bindeval('a:000')" as arguments (am not sure whether star accepts any iterable and not just tuple and list, so this may as well be "*tuple(vim.bindeval('a:000'))") and return the result of the call. Like this:
py << EOF
callables = dict()
def store_callable(c):
key = id(c)
callables[key] = c
return c
EOF
fun GenPyCallable(expr)
let id=pyeval('store_callable('.expr.')')
let d={}
exe "fu d.f(...)\nreturn pyeval('callables[".id."](*vim.bindeval(\"a:000\"))\nendfu"
return d.f
endfun
. I am not sure whether I have everything here right (especially escaping), but this is exactly why I first express the idea in English.
Note that there is also no way I know that allows to do this and keep context (i.e. l: and a: locals or absence of them for use with vim.*eval). This is poind d).
>
> > This list does *not* include partial application, not without lambda
> > subbranch.
> Please document your work on the wiki. We need to have a primary place
> to share ideas/ work/ ..
>
> Marc Weber
>
There actually is a way to keep context: make it a *python* function and not vimL. This makes it harder to use though and if you cope with a) (which is not very hard) you still will not be able to construct a drop-in pyeval replacement for this reason. I.e. GenPyCallable('foo') transforms into pyeval('gen_py_callable(foo)') (note: foo is not a string argument here: using eval in different context omitted).
On Dec 3, 2013 10:08 AM, "Erik Christiansen" <dva...@internode.on.net> wrote:
>
> On 02.12.13 19:41, Marc Weber wrote:
> > > I do not remember clearly, but was not it suggested to take PCRE syntax? I
> > > do not remember any discussions suggesting taking PCRE and replacing parser
> > > code, but I may have missed something.
> > I don't remember wether it was public. Facts: PCRE is fast, it already
> > implements what Bram had in mind, it even has JIT support.
> > But yes, it would be PCRE syntax, too. (Is this good or bad?).
>
> Bad, I suggest.
> Posix EREs are powerful, and standard across many utilities.
> What is important here is that a new regex dialect need not be learnt
> for every utility we use. Productivity results from leveraging learning
> across tools.
Vim syntax looks like BRE (*not* ERE) on steroids unless you use very magic modifier at the start of regex. It looks like nothing else if you do. It is vim who has unique syntax.
PCRE has a bunch of similarities with ERE (nearly any ERE regex can be used without modifications with PCRE) and is pretty common: Perl 5, Python, Ruby, go, PHP, grep (if build with PCRE support and provided -P switch), zsh (if build with PCRE support and some options enabled or specific comparison switch is used).
Note that neither Python nor Perl are actually using PCRE: Python just borrowed the syntax and Perl is where PCRE borrowed syntax from. Do not know which of the other languages I mentioned with PCRE-like regex syntax are actually using PCRE.
Thus by bringing this argument you contradict yourself: if you want to leverage learning across utilities you must use PCRE.
> Erik
>
> --
> The Kyoto Protocol, drafted in 1997, aimed to reduce the world's greenhouse gas
> emissions by around five per cent from 1990 levels by the end of 2012.
> Instead, global greenhouse gases have risen around 58 per cent in that time.
> - http://www.abc.net.au/news/2012-12-08/troubled-un-climate-talks-spill-over/4416696
>
On Dec 3, 2013 10:07 AM, "Marc Weber" <marco-...@gmx.de> wrote:
>
> Excerpts from Nikolay Pavlov's message of Mon Dec 02 20:35:18 +0100 2013:
> > Note: this means that if there is reference somewhere when you redefine
> > function that reference will still use old definition. I consider such
> > stability an advantage.
> I always assumed that
> - restarting Vim is that fast that I do not bother about such changes at
> runtime. Instead I do care about "setting up my dev env" faster, eg by
> using local vimrcs, spending more time on workflows to define the
> compiler (vim-addon-actions) and the like.
I normally trade startup time for other conveniences. As I am using anonymous funcrefs in my plugin this problem does not bother me, but it is what I expect function reference to do in other languages.
>
> > Note that there is also no way I know that allows to do this and keep
> > context (i.e. l: and a: locals or absence of them for use with vim.*eval).
> > This is poind d).
> No, there is not. You have to pass context as arguments manually.
> I didn't try my code. Fact is I'm using it in many ways.
> If you're interested you can find the implementation easily.
It is impossible to pass context and use vim.*eval() like if it was regular pyeval(). I.e. you cannot construct drop-in replacement for pyeval() from my branch which makes the code harder to use.
>
> But anyway: Your work makes me think that having a separate viml library
> is the way to go, so that improvements can be created and debugged more
> easily.
Do not know. Next set of changes to python interface is going to mostly interface things outside of eval.c, the same ones that eval.c interfaces.
I have to solve the problem with crashing compatibility library for older vims first though: I have written most of it, but cannot even start testing.