Re: scsh.net broken link(s)

Emilio Lopes <[email protected]> Tue, 10 Mar 2009 10:13:01 +0100
Newsgroups gmane.lisp.scheme.scsh
Message-ID <[email protected]>
2009/3/7 Andreas Bernauer <[email protected]>:

> Besides the lack of 64bit support, I summarized my reasons, why I don't u=
se scsh
> any more in this rant:
> http://www.lysium.de/blog/archives/215-Why-I-dont-use-scsh-as-a-scripting=
-language-anymore.html

Hello Andreas, hello all!

I hope it's ok for you if I comment on some points of your posting
here.

> Using the interactive session in a terminal is painful, as scsh comes
> without readline support, so you can't really use the interactive
> session in a terminal, unless you like typing a lot.

Since there are several Readline wrappers, e.g.

    http://utopia.knoware.nl/~hlub/uck/rlwrap/

I think it's OK to let this functionality out of Scsh.

> Of course, that would be too easy. scsh now thinks "-o srfi-9 -s" is
> a single switch:

I think this is an Unix shortcoming.  Only one argument is allowed
after the interpreter name.  That's the reason for the "meta argument".
As a general rule you can assume that Olin is a pretty smart guy and
knows what he does.

> Back to how to load some module. As you can't put it on the starting
> line, the scsh authors did not think about some mechanism to load a
> module from within your script (such as "(open-module srfi-9)"), as
> every other reasonable script language does

As you mention further in your posting, the solution for this problem
is to define a structure (module in other languages).  It's better
practice anyway since your script can be used either as a library or
as a script in itself.

> Of course, that would be too easy. Instead of locating the "wrong
> number of arguments" error from above, I have a new error. The
> reason is that the script uses the srfi-9 module to create records
> ("structs" in C lingo). The script uses a switch (instead of some
> import-statement like any other language implementation) to load
> that module, but the interactive scsh interpreter does not care
> about the switches, because they are in the comments.

Using a structure (and opennig it in the config package) would have
solved this.

> The -e main tells scsh to start the script by calling main with the
> command-line arguments. This has two advantages. [...]

And is also good practice, see above.  You might also want to read
Olin Shivers' "A sample exercise in careful script writing":

    http://www.scsh.net/docu/post/signall.html

 Em=EDlio