octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #60763] use of function 'properties' within a


From: anonymous
Subject: [Octave-bug-tracker] [bug #60763] use of function 'properties' within a classdef appears to confuse parser
Date: Thu, 10 Jun 2021 03:51:47 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:89.0) Gecko/20100101 Firefox/89.0

URL:
  <https://savannah.gnu.org/bugs/?60763>

                 Summary: use of function 'properties' within a classdef
appears to confuse parser
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Thu 10 Jun 2021 07:51:45 AM UTC
                Category: None
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Unexpected Error or Warning
                  Status: None
             Assigned to: None
         Originator Name: Odd
        Originator Email: odd.andersen@sintef.no
             Open/Closed: Open
                 Release: 6.2.0
         Discussion Lock: Any
        Operating System: GNU/Linux

    _______________________________________________________

Details:

Using the function 'properties' inside a classdef results in a parse error. 
The following class cannot be instanciated:

classdef PropFail
   properties
      some_prop
   end
   
   methods

      function props = failingMethod(instance)
         
         props = properties(instance);
         
      end
      
   end
end


If I try to create an instance, the following happens:

octave> obj = PropFail()
error: parse error near line 10 of file
/home/oddan/gitted/source/mrst/mrst-other/ruden-geothermal/PropFail.m

  syntax error

>>>          props = properties(instance);
                              ^


If, on the other hand, the 'properties' function is moved out of the lexical
scope of the classdef, it works fine:


classdef PropWorks
   properties
      some_prop
   end
   
   methods

      function props = failingMethod(instance)
         
         props = getprops(instance);
         
      end
      
   end
end

function p = getprops(instance)
  p = properties(instance);
end



I can create an instance of the latter without problem:


octave> obj = PropWorks()
obj =

  PropWorks object with properties:

      some_prop: [0x0 double]





    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?60763>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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