Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Features of rc and es to zsh

Juhapekka Tolvanen wrote:
>But is that true? Or is that document outdated? If that document is right,
>what and when you zsh-developers are going to do to rectify situation?

Woo.  rc and es are so fundamentally different from zsh that we really
can't adopt all their features.  We certainly aren't going to get
zsh emulating rc -- rc syntax is just so fundamentally different from
sh-type syntax.

>                               zsh  rc   es
>Low level command redefinition N    N    Y

I don't see this happening within zsh's current architecture, nor do I
think that we'd want to.

>Has anonymous functions        N    Y    Y

The sh-style language architecture makes this impossible.  There's just
no concept of a value or an object the way that rc has.  If you want
this kind of feature, use Perl.

>Lexically scoped variables     N    N    Y

This could be done only in a very limited form.  The concepts that give
lexical scoping are quite alien to Bourne-style shells, and, while some
of them could be added, without a concept of function objects the utility
of lexical scoping would be minimal.

I think the most minimal version of lexical variables -- declared
variables that become invisible to called functions -- would be useful in
itself, and reasonably feasible to implement.  Closures (and the nested
scopes they imply) would be too big a change.

>Exceptions                     N    N    Y

Possible, but it'd mean a *lot* of internal changes, and there'd
be visible limitations on the mechanism.  Subshells, being separate
processes, can only return an 8-bit status, so exceptions there wouldn't
be able to propagate into an enclosing shell.  (When writing the Elate
shell I gave it string-valued exceptions, which in addition to being
used as exceptions were also used to implement several other flow control
operations.  In fact, the "return" command was itself a shell function.
This subshell problem exists there and is a documented part of the
shell semantics.)


Messages sorted by: Reverse Date, Date, Thread, Author