* zsh needs try-finally
@ 2004-06-01 18:01 Dave Yost
2004-06-01 22:00 ` Nikolai Weibull
0 siblings, 1 reply; 2+ messages in thread
From: Dave Yost @ 2004-06-01 18:01 UTC (permalink / raw)
To: zsh-workers
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: zsh needs try-finally
2004-06-01 18:01 zsh needs try-finally Dave Yost
@ 2004-06-01 22:00 ` Nikolai Weibull
0 siblings, 0 replies; 2+ messages in thread
From: Nikolai Weibull @ 2004-06-01 22:00 UTC (permalink / raw)
To: zsh-workers
* Dave Yost <Dave@Yost.com> [Jun 01, 2004 23:30]:
> Zsh needs a mechanism a la Java's try-finally or lisp's unwind-protect.
Why? Isn't this a bit ambitious for a shell language? Some people
complain that Zsh is too complex already and tries to do too
much...While exception handling is great in most cases, I wonder if a
shell really needs it.
nikolai
--
::: name: Nikolai Weibull :: aliases: pcp / lone-star / aka :::
::: born: Chicago, IL USA :: loc atm: Gothenburg, Sweden :::
::: page: www.pcppopper.org :: fun atm: gf,lps,ruby,lisp,war3 :::
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-06-01 22:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-01 18:01 zsh needs try-finally Dave Yost
2004-06-01 22:00 ` Nikolai Weibull
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).