bugGNU Octave - Bugs: bug #41723, Local functions in classdef files


bug #41723: Local functions in classdef files

Submitted by:  Guillaume <gyom>
Submitted on:  Thu Feb 27 15:52:06 2014  
Category: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: ConfirmedAssigned to: None
Originator Name: GuillaumeOpen/Closed: Open
Release: devOperating System: Any

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

Please log in, so followups can be emailed to you.


(Jump to the original submission Jump to the original submission)

Fri Mar 24 19:54:47 2017, comment #7:

Guillaume: after our discussion at OctConf, I took another look at this. The parsing issue is not too difficult. But while looking at where to store the functions in the symbol table handle the details of properly searching for them, I came to the conclusion that the symbol table code could really benefit from another round of pretty serious refactoring. I have some good ideas on this, but they are too long to write in the margin of a comment box. :-)

But seriously, I will try to do something about this soon as I think the symbol table code has become far too complicated and it seems there must be a better way.

John W. Eaton <jwe>
Project Administrator
Wed Feb 8 06:53:47 2017, comment #6:

Chebfub package (http://www.chebfun.org) makes extensive use of classdef classes and local functions in classdef files.

I am asking again the question in comment #5:
"How difficult would it be to fix the parsing error first?"

Avinoam Kalma <avinoam>
Project Member
Mon Jan 30 10:31:30 2017, comment #5:

Being able to define local functions in classdef files is quite useful when classes become more complicated: how difficult would it be to fix the parsing error first, even if local functions are not dealt with properly to start with?

Guillaume <gyom>
Wed Mar 5 16:00:47 2014, comment #4:

John's right. This construct is not supported yet.

Michael Goffioul <goffioul>
Project Member
Wed Mar 5 15:56:03 2014, comment #3:

I'm pretty sure the issue is that Octave is not expecting there to be anything but comments and whitespace in the file after the END that matches CLASSDEF.

I didn't know that classdef files could define any functions outside of the classdef block.

Fixing the parsing problem will be fairly simple. Fixing the lookup rules so that these functions behave as private functions that are only visible to other functions defined in the classdef file will probably require more work.

John W. Eaton <jwe>
Project Administrator
Wed Mar 5 15:46:27 2014, comment #2:

Hi Felipe,
I removed that line from the MathWorks example beforehand so I'm afraid that's not the explanation.

Guillaume <gyom>
Wed Mar 5 08:10:07 2014, comment #1:

could it be the ellipsis on that line?

Felipe G. Nievinski <fgnievinski>
Thu Feb 27 15:52:06 2014, original submission:

There is a parse error when using a classdef file that contains local functions, as described here:

Guillaume <gyom>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):

No files currently attached


   bug dependencies.

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by avinoam (Posted a comment)
  • -unavailable- added by amro_octave
  • -unavailable- added by cbm
  • -unavailable- added by mtmiller (Updated the item)
  • -unavailable- added by goffioul (Posted a comment)
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by gyom
  • -unavailable- added by fgnievinski (Posted a comment)
  • -unavailable- added by gyom (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri Dec 9 23:23:13 2016amro_octaveCarbon-Copy-=>Added amro_octave
    Fri Mar 20 14:36:26 2015jordighDependencies-=>Depends on bugs #44590
    Fri Aug 22 09:10:57 2014cbmCarbon-Copy-=>Added cbm
    Thu Mar 27 02:44:33 2014mtmillerCategoryNone=>Interpreter
    Wed Mar 5 15:46:27 2014gyomCarbon-Copy-=>Added goffioul

    Back to the top

    Powered by Savane 3.1-cleanup1