Re: Loading code from standard input
Marc Nieper-Wißkirchen 26 May 2020 18:12 UTC
Why standardizing "scripts" (commands read by load or a REPL) at all?
The REPL is not really portable. And R7RS top-level programs are just
perfect to serve as scripts in the Unix sense.
Am Di., 26. Mai 2020 um 20:06 Uhr schrieb Lassi Kortela <xxxxxx@lassi.io>:
>
> > By "script" I mean a program that is executed by a REPL even though it
> > comes from a file. From R7RS section 5.7, last paragraph:
> >
> > An implementation may provide a mode of operation in which the REPL
> > reads its input from a file. Such a file is not, in general, the same as
> > a program, because it can contain import declarations in places other
> > than the beginning.
>
> Right. I didn't realize "REPL from a file" is specified separately. Is
> this the mode that (load "file.scm") uses?
>
> > Whether expressions appearing in such a script are printed or not is
> > left open. "chibi-scheme <foo" treats the file foo as a script, whereas
> > "chibi-scheme foo" treats it as a program.
>
> It might be worth to de-facto standardize this after the fact, but
> that's probably out of scope for SRFI 193. What should we do in 193?
>
> Code read from standard input cannot be a "script" in 193's current
> terminology since it doesn't have a filename. ("/dev/stdin" is not
> appropriate since it's non-portable and not a regular file.)
>
> I guess it can be a "command" though that would be a bit bizarre.