Re: Access class member from command line
Lifepillar <[email protected]>
| Newsgroups | gmane.editors.vim |
|---|---|
| Message-ID | <[email protected]> |
On 2024-05-09, Yegappan Lakshmanan <[email protected]> wrote: > Hi, > > On Wed, May 8, 2024 at 2:11 PM Lifepillar <[email protected]> wrote: >> > Looks like a bug. Should be able to do `foo.Config.option = true` >> >> Indeed. And fixed. That works with the latest Vim (9.1.399). >> > > Yes. This should be addressed by patch 9.1.0398. If you see any > additional problems > in using different types of imported variables in a Vim9 script (after > this patch), please > open an issue. In particular, look for any issues in using nested types. Right now, the only issue I have is with autoload scripts in my vimrc, but I see that it's being tracked as #13313 in GitHub. Other than that, I must say that Vim 9 script has been rock solid for me (no more crashes), and very pleasant to use! >> >> But how do I access the class member from the command line? Is that even >> >> possible? >> >> I still haven't found a way to do that, and I'm starting to think that >> it is not currently possible. If I put this in ~/.vim/autoload/foo.vim: >> > > A class in a Vim9 script is a script-local variable. So it cannot be > directly accessed > from outside the script (without using the script name). I'm not sure I understand. Classes can be exported, and I'm prepending the script name, so why doesn't this work in the command line? :echo foo#C.member where the script is ~/.vim/autoload/foo.vim, `C` is an exported class defined in foo.vim, and `member` is a static variable of C. Maybe because `C` is a type? For comparison, this works in a script: import autoload 'foo.vim' echo foo.C.member Thanks, 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/v1i0o0%24n8%241%40ciao.gmane.io.