On 8/24/06, Martin Baehr <[EMAIL PROTECTED]> wrote:
> On Thu, Aug 24, 2006 at 12:49:43AM +0200, Axel Liljencrantz wrote:
> > Make the 'break' builtin break the calling command in a command
> > substitution. Kind of wacky, and has the _huge_ downside that extrenal
> > commands can't stop the caller of a command substitution from
> > executing, but it would work.
>
> well, with external commands you either have the choice of automaticly
> or manually interpreting their exit status. since automaticly does not
> work, manually will have to do.
Sure, 'foo (bar; or exit)' is pretty simple. In the case of isfile,
one could do something like this:
function isfile
if not count $argv >/dev/null
if status --is-command-substitution
exit
else
return 1
end
end
...
end
That way if isfile fails inside a command substitution, it will fail
the calling command. Bit of extra work, but pretty readable, IMO.
>
> i am not sure about break, how would you use that in a more complex
> function inside a loop? you'd have to watch where uou use it to see
> wether you are actually breaking the calling command or the loop.
>
> how about an aditional throw; builtin?
> maybe later also catch; which would get some interresting error handling
> capabilities...
Real honest to goodness exception handling is an option. It would
probably have loads of other uses, which is nice. The main problem I
see with it is that it leads down the path to making fish a high tech
monster. Simplicity is a virtue.
>
> or what about using exit; for that?
> exit pretty much means, stop this whole command.
True, exit seems more suitable than break.
I'm leaning towards using exit.
>
> greetings, martin.
> --
> cooperative communication with sTeam - caudium, pike, roxen and unix
> offering: programming, training and administration - anywhere in the world
> --
> pike programmer travelling and working in europe open-steam.org
> unix system- bahai.or.at iaeste.(tuwien.ac|or).at
> administrator (caudium|gotpike).org is.schon.org
> Martin Bähr http://www.iaeste.or.at/~mbaehr/
>
--
Axel
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users