nakkaya / ferret

Ferret is a free software lisp implementation for real time embedded control systems.

Home Page:https://ferret-lang.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

*command-line-args* always empty

johnmn3 opened this issue · comments

Are *command-line-args* supposed to be accessible?

When I put:

;;; with-args.clj
(println *command-line-args*)

In with-args.clj, and run:
$ ferret -i file-name.clj -c

[+] Compiling
[+] Formatting Code
[+] Building Binary
[+] Compiler: g++
[+] Options:
-std=c++11
[+] Include Path:
[+] Library Path:
[+] Link:
[+] Done

And do:
$ ./a.out 1 2 3
I get:

()

Is there a compiler config I'm missing?

It is supposed to be accessible, it mimics Clojure's command-line-args. I've fixed the issue added tests. Latest build should work as intended.

I couldn't find *command-line-args* in the docs (my fault I'm sure), so I spent a few hours trying to reverse-engineer how args work by looking through the generated c souce! 😆

Hi,

Its not you apperantly I forgot to mention it in the docs. I've added it under I/O section. On a related note do you have any suggestions to add to the docs that I missed in order to make better sense of the generated code.

Best,

Thank you very much Nakkaya. Ferret is incredible, I'm using it more and more. I'll certainly drop issues and PRs as and when I find gaps in the docs.

First one that came to mind as surprising: The difference between macro-expansion time (ie, compile time) and runtime. I spent a few hours wondering why strings were behaving oddly!