zsh-workers
 help / color / mirror / code / Atom feed
From: Dave Yost <Dave@Yost.com>
To: zsh-workers@sunsite.dk
Subject: zsh needs try-finally
Date: Tue, 1 Jun 2004 11:01:09 -0700	[thread overview]
Message-ID: <pdy988306110445bce273a45648@[209.128.98.50]> (raw)

Hi.

Zsh needs a mechanism a la Java's try-finally or lisp's unwind-protect.

Example:

for file in $*
do
	tmp=$file.TMP-$commandName
	mv -f $file  $tmp
	(eval $filter) < $tmp > $file
	rm -f $tmp
done


The 'rm -f $tmp' command should be in a finally block, something like this:


for file in $*
do
	tmp=$file.TMP-$commandName
	mv -f $file  $tmp
	try
		(eval $filter) < $tmp > $file
	finally
		rm -f $tmp
	yrt
done


See also: http://yost.com/computers/java/finally-throwable.html

Thanks

Dave


             reply	other threads:[~2004-06-01 21:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-01 18:01 Dave Yost [this message]
2004-06-01 22:00 ` Nikolai Weibull

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='pdy988306110445bce273a45648@[209.128.98.50]' \
    --to=dave@yost.com \
    --cc=zsh-workers@sunsite.dk \
    /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).