confusing "invalid use of end" message in octave-4.2.2

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

confusing "invalid use of end" message in octave-4.2.2

help-octave-3
Hello All,

here is a simple example of interactive session demonstrating the probblem:

"

octave:1> foo(end)
error: invalid use of end
octave:1> version
ans = 4.2.2
octave:2>
".


The truth is that 'foo' is undefined, but instead of stating this
clearly first Octave just prints "error: invalid use of end".


In real life I've stumbled upon this using 'plot' commands with some
undefined variables, and it was difficult to find out which exactly
variable was undefined.

--Sergei.



Reply | Threaded
Open this post in threaded view
|

Re: confusing "invalid use of end" message in octave-4.2.2

nrjank


On Tue, May 14, 2019 at 22:49 Sergei Steshenko via Help-octave <[hidden email]> wrote:
Hello All,

here is a simple example of interactive session demonstrating the probblem:

"

octave:1> foo(end)
error: invalid use of end
octave:1> version
ans = 4.2.2
octave:2>
".


The truth is that 'foo' is undefined, but instead of stating this
clearly first Octave just prints "error: invalid use of end".


In real life I've stumbled upon this using 'plot' commands with some
undefined variables, and it was difficult to find out which exactly
variable was undefined.

--Sergei.



Interesting. Matlab returns an Undefined Function error.  Not sure why the parser picks end to complain about first.


Reply | Threaded
Open this post in threaded view
|

Re: confusing "invalid use of end" message in octave-4.2.2

help-octave-3


On 15/05/2019 17:25, Nicholas Jankowski wrote:


On Tue, May 14, 2019 at 22:49 Sergei Steshenko via Help-octave <[hidden email]> wrote:
Hello All,

here is a simple example of interactive session demonstrating the probblem:

"

octave:1> foo(end)
error: invalid use of end
octave:1> version
ans = 4.2.2
octave:2>
".


The truth is that 'foo' is undefined, but instead of stating this
clearly first Octave just prints "error: invalid use of end".


In real life I've stumbled upon this using 'plot' commands with some
undefined variables, and it was difficult to find out which exactly
variable was undefined.

--Sergei.



Interesting. Matlab returns an Undefined Function error.  Not sure why the parser picks end to complain about first.


Does Matlab at least mention the the function name is 'foo' ?


Anyway, to come to the conclusion that 'end' is used illegally the parser has to first scan symbol table(s) and find out that 'foo' is not present in it/them. I.e. it shouldn't be a problem to report 'foo' as unknown name - be it a variable or a function.


--Sergei.



Reply | Threaded
Open this post in threaded view
|

Re: confusing "invalid use of end" message in octave-4.2.2

nrjank
> Does Matlab at least mention the the function name is 'foo' ?

yes.

>> blahblah(end)
Undefined function or variable 'blahblah'.
 


Reply | Threaded
Open this post in threaded view
|

Re: confusing "invalid use of end" message in octave-4.2.2

help-octave-3


On 15/05/2019 17:40, Nicholas Jankowski wrote:
> Does Matlab at least mention the the function name is 'foo' ?

yes.

>> blahblah(end)
Undefined function or variable 'blahblah'.
 

So Matlab does the right thing in this case.


--Sergei.



Reply | Threaded
Open this post in threaded view
|

Re: confusing "invalid use of end" message in octave-4.2.2

nrjank

On Wed, May 15, 2019 at 09:51 Sergei Steshenko <[hidden email]> wrote:


On 15/05/2019 17:40, Nicholas Jankowski wrote:
> Does Matlab at least mention the the function name is 'foo' ?

yes.

>> blahblah(end)
Undefined function or variable 'blahblah'.
 

So Matlab does the right thing in this case.


--Sergei.



Reply | Threaded
Open this post in threaded view
|

Re: confusing "invalid use of end" message in octave-4.2.2

help-octave-3

Thanks.

On 15/05/2019 23:08, Nicholas Jankowski wrote:

On Wed, May 15, 2019 at 09:51 Sergei Steshenko <[hidden email]> wrote:


On 15/05/2019 17:40, Nicholas Jankowski wrote:
> Does Matlab at least mention the the function name is 'foo' ?

yes.

>> blahblah(end)
Undefined function or variable 'blahblah'.
 

So Matlab does the right thing in this case.


--Sergei.