Arc Forumnew | comments | leaders | submitlogin
As.scm and relative paths
4 points by erikb 5763 days ago | 14 comments
Hey guys. Just started today to use arc. In the beginning I used all the stuff in the directory of my arc installation. But now I tried to use it in other places (ergo started to write some code) and now he tells me all the time that he can't load /actual/path/arc.arc.

And yeah, that's correct. So I really have to be in the install path all the time? Does not sound plausible to me. What to do, to use arc everywhere?



2 points by conanite 5763 days ago | link

I just add all my code in subdirectories of my arc installation. For now, arc assumes that the current working directory is the directory containing arc.arc. It's not difficult to put together something that uses a path-like environment variable (eg "ARC_PATH") for searching for arc files (I believe anarki includes something like this) - but you still need to start in the arc directory, even though you can reference arc files stored at a different location.

Official Arc exists to support one app: news.arc (it's running this forum and hacker news). If you were to write a language to support a single app, you wouldn't need fluff like being able to run from a different working directory. [or, as palsecam put it more eloquently, Lisps in general just consider the OS is crap, and they are too "pure" to talk with it.]

If arc becomes widespread, either this will change, or popular ideas about what a language should do will. History isn't in arc's favour here :)

-----

2 points by palsecam 5763 days ago | link

> Official Arc exists to support one app: news.arc

To erikb: yes, don't forget this important point. Sometimes Arc failed on basic stuff, because news.arc/pg's stuff doesn't need it (yet). If you're not going to accept this fact, you'd better not use Arc (or you can do even better: actually improve it to suit your needs :-)).

See also, taken from http://paulgraham.com/noop.html:

There is a danger in designing a language based on one's own experience of programming. But it seems more dangerous to put stuff in that you've never needed because it's thought to be a good idea.

which is wise.

> If you were to write a language to support a single app, you wouldn't need fluff like being able to run from a different working directory. [or, as palsecam put it more eloquently, Lisps in general just consider the OS is crap, and they are too "pure" to talk with it.]

I don't think this is the same idea here.

"Mine" is: you are crazy to create a general-purpose language and completely ignore the rest and the world, i.e the OS and the other programs (not written in your language). (In Common Lisp defense, it was designed at a time the OSes were more diverse & their future uncertain, etc.).

And Arc, as we said, is not so designed to be of general purpose.

And I don't think "if you were to write a language to support a single app, you wouldn't need fluff like being able to run from a different working directory" is totally correct. You can design a language for a single purpose that would include deep cooperation with the OS. E.g: purpose is to write a language to manage firewalling rules.

To conan: anyway, I agree with you in overall ;-)

-----

4 points by pg 5763 days ago | link

This isn't a deliberate design choice. I've just been focusing on other things.

-----

3 points by conanite 5762 days ago | link

I haven't forgotten http://www.paulgraham.com/arc0.html :

  *Arc is still a work in progress. [...] it's
  still in the semi-finished state most software
  is, full of hacks and note-to-self comments about
  fixing them.*
It's good to know that the principle of invoking arc as a script-runner isn't excluded.

-----

1 point by thaddeus 5763 days ago | link

I am not sure if I understand you -> you were originally loading code files from inside the arc directory, somehow, which worked.... Now you are putting your code in a file, elsewhere, and loading from the REPL ? using ... (load "\fullpath\file.arc")? which does not work? Or are your escaping from arc and switching directories then expecting everyting to still work?

More detail could help...

-----

1 point by erikb 5763 days ago | link

too far ahead. ^^ I just want to use the basic arc code from arc.arc and so on. The basic files load the other ones relative, but it seems they load it relative to my position, not to their own.

-----

1 point by palsecam 5763 days ago | link

If you're on a Unix system, you could use an alias: see http://www.arclanguage.org/item?id=10250

-----

2 points by erikb 5763 days ago | link

thx, will try this. But how do you yourself use arc? (Yes, on UNIX. SuSE, Debian, Ubuntu, OS X. But on Windows I would have the same question, I guess. Because it is not described in the install or tutorial text)

And how do you start a script?

in python I just do this: $ python myscript.py

and in php it is this: $ php myscript.php

so I would expect this: $ arc myscript.arc

I wrote a bash script that executes this mzscheme -m -f .... stuff. But still I can't start an arc script from my shell.

It is really strange, it is such a basic stuff, but I can't find it in the install/tutorial text. Maybe there is some way that the lisp or scheme usage in common differs from the usage of other languages like python or php?

-----

4 points by palsecam 5763 days ago | link

> It is really strange, it is such a basic stuff. Maybe there is some way that the lisp or scheme usage in common differs from the usage of other languages like python or php?

Absolutely true. In short, Lisps in general just consider the OS is crap, and they are too "pure" to talk with it. Hence, no easy way to start a script. Hence (also), no popularity because the majority of people live in the real world and not in the ideal lambda calculus one ^^ (this is not that bad with MzScheme or say SBCL [Common Lisp implementation] to be honest)

> But how do you yourself use arc?

Mostly dealing with the fact that it fucks the Unix philosophy, but I patched it to be a little less stupid on that. Sorry, no time now, but I'll post the patch in the near future, although it is not as sufficient as I'd like yet.

To reply more directly: nearly exclusively from the REPL.

-----

2 points by palsecam 5759 days ago | link

> I patched it to be a little less stupid on that. Sorry, no time now, but I'll post the patch in the near future, although it is not as sufficient as I'd like yet.

Done & sufficient now. See http://www.arclanguage.org/item?id=10344. And directly solves the relative paths problem.

-----

1 point by erikb 5755 days ago | link

I saw it before looking here. very nice work! :)

-----

4 points by thaddeus 5763 days ago | link

To launch arc - I use a unix command file:

  #!/bin/sh
  (cd /home/programs/arc;
   /home/programs/scheme/bin/mzscheme -f as.scm)
As for windows read:

http://arclanguage.org/item?id=9263

and

http://arclanguage.org/item?id=9382

Also - here are a few others to read:

1. Starting an arc script: http://arclanguage.org/item?id=9617

2. Easy means to search the arc forum: http://af.searchyc.com/

3. Good documentation: http://arcfn.com/

-----

3 points by erikb 5763 days ago | link

thx guys. I will read more on arcfn.com. I am very happy that there actually is more documentation! And I am still interested to see more information here. Are there other people out there, who have invested some energy in enhancing the usability of arc? Please tell me more!

-----

3 points by conanite 5763 days ago | link

Take a look at anarki, a community-maintained fork of arc with a bunch of enhancements (I don't know if there's a simple list of changes anywhere) ... and rainbow (an arc interpreter in java; mostly the same as arc except for access to java libs; dunno if that counts as "enhancing usability" :))

anarki http://github.com/nex3/arc/tree/master

rainbow http://github.com/conanite/rainbow/tree/master

-----