octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: return, continue, break -> ans = 1


From: John W. Eaton
Subject: Re: return, continue, break -> ans = 1
Date: Wed, 4 Dec 2002 11:07:09 -0600

[I've removed all bug octave-maintainers, since I don't think this is
as much about a bug in Octave as something that should be discussed as
a possible new feature.  --jwe]

On  4-Dec-2002, Pascal A. Dupuis <address@hidden> wrote:

| On Tue, 3 Dec 2002, John W. Eaton wrote:
| 
| > My changes were simple.  They just made break, continue, and return do
| > what did before, but also behave as functions that returned 1 so they
| > would be valid in logical contexts.  But a simple change is not good
| > enough, and I don't see a way to allow the Perl-like behavior and also
| > be backward compatible without making some major changes to the way
| > Octave's parser and interpreter work.  I don't think it is worth the
| > effort and I've undone the changes I made earlier.  The CVS archive
| > should be updated within a few minutes.
| >
| 
| Hello John,
| 
| In fact, the || and && construct with a second member of return, break, or
| continue is a sh mechanism (roughly speaking, Perl is a glue logic system
| which supersedes sh). It is available in bash. May I suggest to ask to the
| peoples maintaining bash how this is accomplished there, and eventually
| transpose it to octave ?  Just a 2 eurocent suggestion...

I'm well aware that these kinds of operations are also possible in
Unix shells.

I'm also not opposed to this feature, but what I was trying to tell
you in my previous message is that it simply does not fit in with
Octave's current implementation.  I think I know how it is implemented
in bash, and although it is similar to the way Octave works, there are
some significant differences.

So I think to implement this feature properly would require more than
a few minutes of work.  I only attempted to do it because I thought I
saw a simple way, but it turned out to have more bad features than
good, so I had to remove it.  Now I'd rather spend time working on
things that I (and the person who signs my paycheck) think are more
important.

If you really want this feature in Octave, then I suggest you provide
a patch, or consider providing funding to someone who can implement it.

jwe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]