[Top][All Lists]

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

Re: purpose of 10486:4e64fbbd5c58

From: Jaroslav Hajek
Subject: Re: purpose of 10486:4e64fbbd5c58
Date: Tue, 6 Apr 2010 21:49:22 +0200

On Tue, Apr 6, 2010 at 6:07 PM, John W. Eaton <address@hidden> wrote:
> On  6-Apr-2010, Jaroslav Hajek wrote:
> | I figured out a slightly better solution, that doesn't pollute the
> | other functions using index_vector,
> What do you mean by "pollute the other functions..."?

See the other response. This influences a number of other functions
that you probably didn't mean to change.

> | so I reverted the previous change
> | and suggest the attached one as a replacement. This time the change is
> | done in the interpreter so does not leak to other contexts and is
> | controlled by a variable, which is on in the maximum braindamage mode.
> Why shouldn't we just allow this by default?  I agree that indexing
> with non-integer values is sloppy and should not happen without a
> warning, but I don't see how allowing it (with a warning) can cause
> trouble, so why not allow it by default?

I'm not strictly against it, it just seems weird to me. I do rely on
the proper behavior sometimes, so I would like at least a means to
restore the normal behavior. Namely, I frequently use the trick
index = (1:M)(index); # validate index

> | Note that this still is not quite Matlab compatible (neither is your
> | previous change), because Matlab (2007a) allows this:
> | a(1.1:4)
> | with a warning, yet disallows this:
> | i = 1.1:4;
> | a(i)
> |
> | Apparently Matlab treats the ranges differently than we do, hence the
> | difference.
> OK, that is surprising.
> | The behavior seems undocumented and IMHO likely to be
> | removed (the warning even says that integers are *required*) in the
> | future. I suggest you rethink whether you really want Octave to
> | support this nonsense at all.
> At least until I understand more clearly why it causes so much
> trouble, I think I do want to allow it.
> jwe

I guess it would take a not-quite-trivial effort to make it exactly
Matlab compatible (cf. the above example). If you don't make it Matlab
compatible, you sort of lose the primary motivation for this whole

Do as you wish if this didn't convince you, I think I've exhausted all
my arguments. I know you have a negative attitude towards more global
variables, but if it's possible, I'd like to have a way to turn this
stupidity off.

RNDr. Jaroslav Hajek, PhD
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz

reply via email to

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