It works fine for me once I correct a couple of bugs:
vim9script
class Inner
public this.val = 13
endclass
class Outer
public this.inner = Inner.new()
endclass
var o1 = Outer.new()
o1.inner.val = 11
echo o1.inner.val
On Tue, Sep 19, 2023 at 6:50 PM errael <[email protected]> wrote:
> Steps to reproduce
>
> In #13118 (comment)
> <https://github.com/vim/vim/issues/13118#issuecomment-1726020513> it says
>
> In the current implementation the read-only object variable behaves like a
> "final" variable.
>
> The following script gives the error
>
> E1335: Member is not writable: inner
>
> While it's true that inner is not writable, the test does not attempt to
> write to the variable inner. It is writing to the class Inner public
> variable val.
>
> vim9script
>
> class Inner
> public this.val = 13
> endclass
>
> class Outer
> this.inner = Inner.new()
> endclass
>
> var o1 = Outer.new()
>
> o1.inner.var = 11 # <<<<< can't write
>
> Expected behaviour
>
> No error. The object's variable val is written to.
> Version of Vim
>
> 9.0.1916
> Environment
>
> ubuntu
> Logs and stack traces
>
> *No response*
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/vim/vim/issues/13130>.
> You are receiving this because you are subscribed to this thread.Message
> ID: <vim/vim/issues/[email protected]>
>
> --
> --
> 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].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/vim_dev/vim/vim/issues/13130%40github.com
> <https://groups.google.com/d/msgid/vim_dev/vim/vim/issues/13130%40github.com?utm_medium=email&utm_source=footer>
> .
>
--
Christian J. Robinson <[email protected]>
--
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/CAK14FZJNDVJQ69EnHv8DijbBJXW7TSD5b9EDwV%2B5xkQMgu9TVg%40mail.gmail.com.