scsh-users
[Top] [All Lists]

Re: Perl, English, syntax for Scheme and shells (was Re: scsh in scm ...

To: scsh@martigny.ai.mit.edu
Subject: Re: Perl, English, syntax for Scheme and shells (was Re: scsh in scm ...)
From: wilson@cs.utexas.edu (Paul Wilson)
Date: 11 Jan 1996 14:37:35 -0600
Organization: CS Dept, University of Texas at Austin
In article <199601052019.OAA01671@europa.cs.rice.edu>,
Shriram Krishnamurthi <shriram@cs.rice.edu> wrote:
>Paul Wilson wrote:
>
>>       (John Ellis?) did a Lisp shell several years ago, where any
>>       unbound function name was assumed to be an indication that
>>       the programmer meant to call a UNIX program. [...]
>
>I thought (I'm about 800 miles from my Scsh docs ...) Olin explicitly
>wrote about this in his document (in the Tao section?).  I agree with
>Olin on this front.  One of the reasons I would even be interested in
>this command system is to integrate the two environments cleanly.  To
>then make commands dependent on the environment strikes me as a stride
>in the wrong direction.
>
>To resolve the situation, I could live with the language _defaulting_
>in the other direction (ie, unless stated otherwise, the Unix
>namespace is used), but even this strikes me as undesirable.
>Personally, I know that if I could combine the two environments, most
>of what I run would, in fact, be from the Scheme environment (much of
>it, undoubtedly, chaining off eventually to something from Unix), and
>the number of actual raw Unix commands I would use would be few.
>Kolmogorov strikes.

I'd say that if there's a terse/Scheme split along the lines Olin
recommends, the terse mode should default to running UNIX programs,
but the Scheme mode should not.

Either way, there should be a clean abstraction of how this works,
and a clean way of toggling it.

For example, suppose we represent the UNIX environment as a Scheme
module, with the funny property that it defaults to looking things
up as UNIX programs in the UNIX path, if it can't find a normal
Scheme binding.

There could be a "with" form that brings a module into scope, and
exiting that form would make the module inaccessible again.
That way, in a local segment of your program, you can switch on
the default-to-unix property, without the unsafety of that mode
infecting your whole program.

(foo bar)           ; will not see a UNIX foo program if we forgot to define foo
(with os-envt
  (if (file-exists? "foo")
      (rm foo))     ; will see the UNIX rm command, backquote its args
      (display "couldn't find foo, so couldn't delete it")))
(quux baz)          ; UNIX is out of scope again now

or in tersified, reduced-parens syntax, something like

foo bar
with os-envt
  if file-exists? "foo"
  then rm foo
  else display "couldn't find foo, so couldn't delete it"
  fi
htiw
quux baz

-- 
| Paul R. Wilson, Comp. Sci. Dept., U of Texas @ Austin (wilson@cs.utexas.edu)
| Papers on memory allocators, garbage collection, memory hierarchies,
| persistence and  Scheme interpreters and compilers available via ftp from 
| ftp.cs.utexas.edu, in pub/garbage (or http://www.cs.utexas.edu/users/wilson/) 
     

<Prev in Thread] Current Thread [Next in Thread>