Hi all,

I'm wondering if I'm seeing an error

":help lockvar" seems to indicate that the following should work.
The goal is to get a writable variable "l1" that holds a locked list.

    vim9script
    var l0: list<list<number>> = [ [1, 2, 3], [4, 5, 6], [7, 8, 9] ]
    var l1 = l0
    lockvar! l1
    unlockvar 0 l1      # <<<<< expect "l1" writable, list still locked

    # Not modifying the value, but gets a value locked error
    l1 = null_list  # E741: Value is locked: l1

Can do it this way

    vim9script

    var l0: list<list<number>> = [ [1, 2, 3], [4, 5, 6], [7, 8, 9] ]
    lockvar! l0
    var l1 = l0

    #l1[0] = []          # fails as exepcted
    l1 = null_list      # works as expected

-ernie

--
--
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/ff22fece-5b16-b52d-dbd3-59e7780b3ead%40raelity.com.

Raspunde prin e-mail lui