[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (problem? 'guile)



On Nov 27, Matthias Felleisen wrote:
> 
> Okay, I will answer one question. The following is the header of my current
> homework assignment: 
> 
>    #! /bin/sh
>    #|
>    exec /usr/local/lib/plt/bin/mzscheme -r $0
>    |#

I prefer

  exec mzscheme -r "$0" "$@"

since mzscheme is on my path anyway, and I want to use command-line
arguments.

Anyway, I wanted to say that I think that this approach is generally
better than the

  string=? ; ...

not only because it evaluates an unnecessary token, but because of the
convenience of "#" being a line-comment characters in probably every
possible shell.  (Besides, "string=?" will look for one-character
filenames in the current directory which might lead to problems in
case you're in some weird directory (like some screwed up mount
point).)

In addition, because you can get anything in the comments, you can put
anything you want before the "exec", my favorite case is playing
around with some C extension -- I'll put the compilation commands
before the exec so I if even if I modify the C code I still just have
to run the script.

My bottom line is -- I think that this is much better so it is better
to be put in the documentation instead of the "string=?" thing.

And while I'm at this, I helped someone recently write scripts on
Windows, and I think that the general approach of creating a new
association for a suffix like ".sx" that will run mzscheme with the
"-r" flag is better since it avoids adding stuff to the top and the
bottom of the file.  I think it should be possible to add this
association as part of the setup, and to create another entry in the
context menu for .sx files that will allow you to open the file in
DrScheme like normal .ss files (I can ask the local Windows expert if
this sounds reasonable enough).

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!