[r6rs-discuss] [Formal] "#! /usr/bin/env" is not "portable." It's Unix-specific.

From: Nils M Holm <holm>
Date: Wed Nov 15 09:33:26 2006

On Wed, Nov 15, 2006 at 02:11:24PM +0100, Jens Axel S?gaard wrote:
> Nils M Holm skrev:
> >On Tue, Nov 14, 2006 at 10:04:40PM -0500, Peter Gavin wrote:
> >>In addition, I would drop the requirement that the first line be
> >>ignored. That wouldn't be needed were #! a comment indicator.
> >
> >Ignoring the first line would open the door to a lot of bad
> >surprises for people who start learning Scheme.
>
> In practise, implementations will probably only ignore the
> first line, if it starts with a #!

I would be happy if this was so, but in <7.1.1> R5.91RS states that

"Implementations are required to ignore the first line, however,
 even if it is not the above."

("The above" being "#! /usr/bin/env scheme-script".)

> >Plus it would make all one-liners two-liners, which I think
> >would be rather inelegant.
>
> If we don't treat the first line specially, then all one-liners
> become two-file scripts in Unix.

I am not against #! in general, I just do not understand why
we have to treat the first line in a special way. Why is it not
sufficient to make #! a comment to the end of line?

This would still allow you to run

% echo "(+ 1 2 3)" | my-interpreter

while enabling Scheme programs to run as scripts at the same time.

What am I missing?

-- 
Nils M Holm <nmh_at_t3x.org> -- http://t3x.org/nmh/
Received on Wed Nov 15 2006 - 09:31:26 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:00 UTC