Wednesday, January 5, 2022

Re: Vim9 import [was Vim9 script feature-complete]

On 2022-01-04, Marvin Renich <mrvn@renich.org> wrote:
> * Bram Moolenaar <Bram@moolenaar.net> [220104 12:26]:
>> While using:
>>
>> import "thatscript.vim"
>>
>> Or:
>>
>> import "thatscript.vim" as that
>>
>> Is nice and short, no need for "from". The help for ":import" becomes
>> much shorter. The implementation will also be much simpler.
>>
>> The discussion about the need for using the prefix, whether "as" should
>> be required and other things, seem less important.
>
> Actually, I think the local namespace pollution is the more important
> issue, and requiring "as" and the prefix gives the simpler import syntax
> as an added benefit.

FWIW, my preference, too, goes to using just one form:

import "thatscript.vim" as that

with a mandatory "as" clause. Then, I'd vote for funcrefs and consts as
an aliasing mechanism, as already suggested. I find the argument that
changes to an imported script may break the importing script pretty
compelling, so I would withdraw my proposal of a "use that" command to
indiscriminately import everything into the script's namespace.

Life.


--
--
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/sr3ooo%243vk%241%40ciao.gmane.io.

No comments: