Arc Forumnew | comments | leaders | submitlogin
Arc on the command-line
5 points by conanite 6185 days ago | 1 comment
Being the duty of this forum to describe what other languages have that arc lacks:

1. Command-line args: I'd like to tell my arc machine to read in some files; to evaluate a form on the command-line; to pass some arguments to my lisp program. In other words

  arc -f file1 file2 -e '(run-my-cool-program 12 34 "abc")' -args ~/cool-program-data
Everything following "-args" gets assigned to argv or something similar so my arc program can access it. I didn't see how to do this in the current arc.

2. At the moment, as.scm loads "arc.arc" followed by "libs.arc" in the current directory. An "ARC_PATH" environment variable and/or command-line argument might be useful, working on similar lines to ruby's library load-path ("$:"). Then, (lib "strings") would find "strings.arc" in the ARC_PATH. The goal is so that I can start my arc machine with no libraries at all, the standard arc.arc + libs.arc, a different arc.arc (eg Anarki's), or something else entirely. The ARC_PATH could reasonably incorporate remote locations, as suggested by http://arclanguage.org/item?id=6506

3. Ruby has "__FILE__" so that each script knows where it's running from, and can thus load relative paths. I imagine (load-relative __FILE__ "other-stuff.arc") being useful. __FILE__ should work as expected for remote scripts also.

These kinds of features seem simple yet necessary for smooth deployment and integration of arc applications. Maybe this has been discussed already, if so, sorry for the duplication.



3 points by almkglor 6185 days ago | link

1. This will probably be done in arc2c eventually. Shouldn't be too difficult either.

2. On Anarki the variable 'current-load-file* does this. However the current solution is not thread-safe and having two threads perform 'load at the same time will fail. This means that 'current-load-file* might be changed to a 'thread-local, meaning its contents will be accessed via '(current-load-file* ) - currently it's just 'current-load-file*

3. Someone has to modify infile to do this seamlessly.

-----