JohnEarnest / ok

An open-source interpreter for the K5 programming language.
MIT License
587 stars 72 forks source link

Exposed argv as a global x #38

Closed ngn closed 8 years ago

ngn commented 8 years ago

When oK is run as ./repl.js filename.k arg0 arg1 arg2, it may be convenient to have (arg0;arg1;arg2) as x in the global scope.

refi64 commented 8 years ago

FYI, Kona uses _a for this.

ngn commented 8 years ago

Kona also includes filename.k in _a.

x looks more natural to me -- the way a function has an argument, the whole program has (a list of) command-line arguments.

JohnEarnest commented 8 years ago

I think that @ngn's approach here is reasonable. I have no idea how (if?) k5 exposes argv to scripts, but I don't consider strict compatibility with k5 very important in the repl itself, as it is separate from the interpreter and by design users can furnish their own alternative frontends.