octave-maintainers
[Top][All Lists]
Advanced

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

Re: help understanding package/class/function references


From: John W. Eaton
Subject: Re: help understanding package/class/function references
Date: Fri, 15 Feb 2019 14:23:54 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0

On 2/15/19 1:11 PM, Nicholas Jankowski wrote:


On Fri, Feb 15, 2019 at 12:41 PM John W. Eaton <address@hidden <mailto:address@hidden>> wrote:

    Could someone run the following test in a recent version of Matlab?


Matlab 2018b:

 >> apkg.cls.smeth
ans =
   struct with fields:
     f: 'cls'
 >> apkg.cls.smeth.f
ans =
     'cls'

So the result of calling a static method may be further indexed? That's a bit of a surprise.

 >> apkg.fcn
ans =
   struct with fields:
     f: 'fcn'
 >> apkg.fcn.f
Undefined variable "apkg" or class "apkg.fcn.f".

I'm not sure I understand how this error happens. Is it because the package "apkg" is found but since "fcn" is not the last element of the "." index chain Matlab doesn't even look for a function called "fcn"? Instead, the only valid things would be for "apkg" to be a variable or "fcn" to name another package or a class? In that case, we have to examine fcn.m to determine whether it defines a classdef object.

jwe




reply via email to

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