help-octave
[Top][All Lists]
Advanced

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

Re: isa strangeness


From: Jaroslav Hajek
Subject: Re: isa strangeness
Date: Mon, 16 Aug 2010 09:02:19 +0200

On Mon, Aug 16, 2010 at 8:50 AM, Martin Helm <address@hidden> wrote:
> Am Montag, 16. August 2010, 08:10:47 schrieb Jaroslav Hajek:
>> On Mon, Aug 16, 2010 at 4:31 AM, Martin Helm <address@hidden> wrote:
>> > The help string of isa is not really good here.
>> > Use
>> > isa(10, "double") or isa(10, 'double')
>> > class in isa is expected to be a string here which contains the class
>> > name. The reason is the syntax
>> > isa(10, double)
>> > will treat double as a function call without arguments, which is a syntax
>> > error.
>> > - mh
>>
>> On the contrary, I think that the help string is OK, It's just that
>> Richard doesn't understand the fundamentals of Octave syntax; but we
>> surely can't repeat those in every docstring, can we?
>
> I try to think like someone who  never  has used octave or matlab here (and I
> think he mentioned that in an indirect way by stating that he installed
> yesterday octave and works through the manual).

Yes, most likely that's why he doesn't understand. I wasn't implying
anything about Richard's mental capabilities or whatever else.

> And if I read the output of "help isa" it is not clear (for me it was , but
> probably simply because I am used to it and never think about that) that CLASS
> is a name (in fact looking at the code with "type isa" the same input variable
> is called cname in the code which is much more descriptive).
>

What else can CLASS be? The example Richard tried

isa (10, double)

makes no sense because an unquoted non-keyword plain literal in Octave
implies either a variable query or, if no such variable exists, a
function/class call. *CALL*, not reference. It's obvious that you
don't want a call here.
The next example

isa (10, double(10))

makes even less sense. Only the final one was correct, albeit not
useful. I still think the docstring is OK, although you're welcome to
improve it. Octave simply treats name somewhat differently than, say,
Python, but once you learn how, it makes sense.

regards

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