Re: Access class member from command line

Igbanam Ogbuluijah <[email protected]>
Newsgroups gmane.editors.vim
Message-ID <CAOmRJrcLVHMM9bVJKvbAHjHvKOH1wi9fULf74jzexQS7u4V9tg@mail.gmail.com>
Yeah, all variables within vim9script seem script-local. If you want to
access them in the command line, you'd have to prefix them with the scopes
in :h eval.txt — global, window, and buffer all work.

Best,
Igbanam

On Sun, May 5, 2024 at 2:39 PM Lifepillar <[email protected]> wrote:

> Let's say I have this class in some `foo.vim` file:
>
>     export class Config
>       public static var option = false
>     endclass
>
> Now, I'd like to set `Config.option` to `true` from a script and from
> the command line. From a script, I can do this:
>
>     import `foo.vim`
>
>     type FooConfig = foo.Config
>     FooConfig.option = true
>     echo FooConfig.option  # OK
>     echo foo.Config.option # Also works
>
> Unfortunately, this gives an error (Undefined variable Config):
>
>     foo.Config.option = true
>
> But how do I access the class member from the command line? Is that even
> possible?
>
> Context: I'm exploring alternatives to `g:myplugin_option` to configure
> a script without using global variables.
>
> 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/v1826l%24m0o%241%40ciao.gmane.io
> .
>

-- 
-- 
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/CAOmRJrcLVHMM9bVJKvbAHjHvKOH1wi9fULf74jzexQS7u4V9tg%40mail.gmail.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.