[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Yow!
This has got to be the best unix shell I've ever seen!
A couple of nits, though.
1) $cdpath is a really egregious creeping feature to make a builtin part of
the shell, considering how nongeneral it is. If people really want a
cdpath-like feature (admittedly, I use such a thing too), one could do:
fn cd * \
{
if { ~ $#* 0 } { * = $home }
if { ~ $1 ./* ../* /* } \
{
$&cd $1 ;
pwd # I don't like this --noah
return 0 ;
}
let (dir = <={ access -1 -d -n $1 $cdpath })
if { ~ $dir () } \
{ throw error $0 $0: $1 not in '$cdpath' } \
{
$&cd $dir
pwd # I don't like this --noah
return 0
}
}
Alternately, instead of calling `access' in `cd' directly, one could call
%cdpathsearch, but I think this doesn't really belong as a builtin hook
either.
2) The man page says for `forever',
Runs the command repeatedly, until the shell exits or the command
raises an exception. This is equivalent to a while {true} {cmd} loop
except that forever does not catch any exceptions, including break.
It seems like it would be more general to indeed have a looping construct
that didn't catch any exceptions, but that also allowed a test of some
sort. Perhaps `while' could even be implemented in terms of this new
construct, setting exception handlers first.
Admittedly, right now you can create your own magic exception and use that
to get of out of `forever', so it might seem like adding a condition is
just syntactic sugar. But I can imagine wanting to avoid the risk of
shadowing an identically-named tag for another exception handler further
up.
3) `local' doesn't seem like a very well-chosen name. In fact, because
"local" variables still cause settors to be invoked, get exported, and have
other dynamic-scope properties, they are far less "local" than lexically
scoped variables created with `let'. Perhaps a better name would be
`fluid-let' or even `dynamic-let'? (The former would at least be
consistent with Scheme.)
Happy hacking.