zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: "Zsh Hackers' List" <zsh-workers@zsh.org>
Cc: Jilles Tjoelker <jilles@stack.nl>
Subject: Re: Fw: zsh POSIX_TRAPS option
Date: Mon, 11 Oct 2010 08:16:52 -0700	[thread overview]
Message-ID: <101011081652.ZM18151@torch.brasslantern.com> (raw)
In-Reply-To: <20101011094241.17796aaa@pwslap01u.europe.root.pri>

On Oct 11,  9:42am, Jilles Tjoelker <jilles@stack.nl> was quoted
} by Peter W. Stephenson:
} 
} Regarding the POSIX_TRAPS option, I can't help but wonder if making a
} difference between f() { ... } (POSIX functions) and function f { ... }
} (ksh functions) instead of adding more and more options would make
} things less complex.

That could have been a good idea when the "function" keyword was first
introduced, but we now have years of treating them equivalently to
think about.  (Also, whether functions have their own traps is based
on the LOCAL_TRAPS option, not the POSIX_TRAPS option, except for the
special case of the EXIT trap.)

In particular there's the problem of autoloaded functions.  We already
have several potentially confusing tricks to designate KSH_AUTOLOAD and
to define the of function correctly in the event the file is loaded
under the wrong regimen.  Having an additional behavior that changes
depending on these circumstances would seem to me more complex rather
than less, particularly if there's no way to test for that behavior.

} In ksh93, ksh functions have their own traps, while POSIX functions
} share the invoker's traps.

This is suddenly seeming familiar.  There may have been discussion of
changing zsh semantics of "function f" vs. "f()" at some earlier time,
but I have no idea how to do an efficient list archive search for it.

I have only a year-old version of mksh to conveniently play with.  What
does "have their own traps" imply during function execution about traps
that were set before the function was entered, when the function does
NOT redefine them?


  reply	other threads:[~2010-10-11 15:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-11  8:42 Peter Stephenson
2010-10-11 15:16 ` Bart Schaefer [this message]
2010-10-15 13:47   ` Jilles Tjoelker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=101011081652.ZM18151@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=jilles@stack.nl \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).