On 9/15/06, Beni Cherniavsky <[EMAIL PROTECTED]> wrote:
> On 15/09/06, Axel Liljencrantz <[EMAIL PROTECTED]> wrote:
> > On 9/14/06, Beni Cherniavsky <[EMAIL PROTECTED]> wrote:
> > > But things like ``end (echo no)`` are useless, because the right
> > > answer is always known and you only wish to state it clearly.  If you
> > > disallow expansions in end's argument, it could be checked as part of
> > > the syntax checks before the command is ever run, which I think would
> > > be much more intuitive.
> >
> > You could do that, but there is honestly no reason to _ever_ write
> > 'end (echo no)', so I don't see why you should change the language
> > syntax to make it larger and less consistent just to disallow it.
> >
> To allow the error to be detected at parse time, rather than after
> some (perhaps wrong) commands were executed.  The whole point of the
> ``end foo`` feature was to detect brocken syntax; if it isn't detected
> early enough, the feature is half-useless.
>
> Disabling expansions is not a goal in itself, it's just needed (as far
> as I understand) so it can be checked at parse time.  I don't know
> whether this special-casing can be easily implemented.  It might not
> be worth it.

You don't need to forbid expansion to get ahead-of-time syntax
checking.  That is already what happens. If you don't use any
expantions, the syntax error _will_ be checked at parse time. If you
write

for i in 1 2 3
    ...
end if

then nothing will ever get executed, and the parser will give you an
ahead-of-time error.

Fish keeps track of commands which have not been given any arguments
with parameter expansions, and validate more things in those cases.
For example, it is perfectly valid to write:

set for_args i in *.c

for $for_args
   ...
end
while writing

for i *.c
    ...
end

is a syntax error that will be caught ahead of time since there is no
'in' argument.

>
> --
> Beni Cherniavsky <[EMAIL PROTECTED]>, who can only read email on weekends.
>


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

Reply via email to