metakirby5/codi.vim

function declaration hoisting

rafpaf opened this issue · 2 comments

typeof functionName, written before the function is declared, should equal 'function', since function declarations are hoisted to the top of the scope. However, codi gives a ReferenceError.

Please refer to FAQ, and use the issue template next time.

Why doesn't X work in Codi, when it works in a normal source file?
Codi is not meant to be a replacement for actually running your program; it supports nothing more than what the underlying REPL supports. This is why Haskell language pragmas don't work and OCaml statements must end with ;;.

If you enter the contents of your source file into the corresponding interpreter, you will find the same result. What occurs in the future cannot be hoisted to the top 🙂

Thanks for making such a brilliant plugin, @metakirby5, and for your kind explanation.