Skip to content

Instantly share code, notes, and snippets.

@kat0h
Created July 31, 2022 14:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kat0h/d241bd0422fe1728a862f960056ec3b9 to your computer and use it in GitHub Desktop.
Save kat0h/d241bd0422fe1728a862f960056ec3b9 to your computer and use it in GitHub Desktop.
Vimのバグ!
let Ref = function({val -> execute("echo val")})
call Ref("hoge") " => hoge
vim9script
var Ref = function((val) => execute("echo val"))
Ref("hoge") # => E121: Undefined variable: val

この挙動

def s:hoge(val: string)
  echo val
enddef

def s:hugo()
  var Ref = function("s:hoge")
  Ref("HOGE")
enddef
 
function s:foo()
  let Ref = function("s:hoge")
  call Ref("HUGO")
endfunction
 
call s:hugo() " -> E1267: Function name must start with a capital: s:hoge
call s:foo() " HUGO

この挙動

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment