On 23/03/18 1:29 PM, Bram Moolenaar wrote:
Ernie Rael wrote:

Doing

     def T()
     enddef
     echo T->get('name')
     echo T
     finish

produces this output

     <80><fd>R34_T
     <SNR>34_T

Is this expected? I just saw `T->get('name') and thought I could
use it to replace a spot where I'm extracting the name from `string(T)`.
I get:

        E121: Undefined variable: T
        E121: Undefined variable: T

When I prepend "vim9script" then I do get the output you mention.

The output looks OK, you get the internal name of a script-local
function.  Either the byte-code version or the printable version with
<SNR>.  Note that you can also get the printable version with:

      echo function('T')->get('name')

Thanks. Now I get it; it's magic. (easier for me to understand than delving
into byte-code version and what I'd do with it.)

Never having learned vimscript, seems there are some things I'm not
easily getting a feel for, since with vim9script...

-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/81307a37-c0eb-2c8b-f81b-f07cc7574442%40raelity.com.

Raspunde prin e-mail lui