On 9/13/06, Axel Liljencrantz <[EMAIL PROTECTED]> wrote:
> A user on IRC recently suggested that it should be possible to specify
> what an end block actually ends, like:
>
> if false
>     echo this never happens
> end if

I'm not sure I understand the purpose of this feature.  If it is to
make it clear which block the end-command ends, then why not use
block-specific end commands, like "fi" for "if", etc?

This feature makes the language more complicated, and so makes code
harder to read.  To understand an if-statement that has an end
condition, I now have to remember to check not only its if-condition
but also the end-condition.  I expect that more bugs will occur from
forgetting to check this, than the bugs avoided by it.

Even the fact that a block can end in more than one way would make
code harder to read; for example if both ``end'' and ``fi'' end an
if-block.  It is better to choose one and stick to it.


> This would be caught before trying to execute the file/command:
>
> if true
>     echo nor will this
> end begin

So the ``echo`` command is not executed and the status after executing
the ``if`` block is 1?  Does this signal a syntax error?  Does it keep
the expression on the command line, as when you enter, say

if true; echo nor will this;


> While this loop will execute _once_ after which time the end command will 
> fail:
>
> for i in 1 2 3; echo $i; end (echo no)

Why doesn't it do the same as with the ``if`` block when the end
condition fails, namley to fail before executing the body?

-------------------------------------------------------------------------
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

Reply via email to