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

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

[Octave-bug-tracker] [bug #49169] Class can't be called from builtin fun


From: Mike Miller
Subject: [Octave-bug-tracker] [bug #49169] Class can't be called from builtin function.
Date: Mon, 26 Sep 2016 21:24:01 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:49.0) Gecko/20100101 Firefox/49.0

Update of bug #49169 (project octave):

                  Status:                    None => Need Info              

    _______________________________________________________

Follow-up Comment #1:

This error is probably because the class function knows whether it is being
called from a class constructor function or not. If you call it using builtin,
that adds an indirection to the stack and it no longer knows that it is in a
constructor context.

However, you don't need to use builtin to do what you want. I made a simple
example to show the class I think you are describing:


>> type @foo/foo

function x = foo ()
  x = class (struct (), "foo");
endfunction


>> type @foo/class

function s = class (x)
  s = "foo-type";
endfunction

>> x = foo;
>> class (x)
ans = foo-type


It seems to work for me without needing to use builtin, probably because
Octave defers calling overridden methods in the constructor.

Is there something missing in your example that shows why you need to use
builtin and why you think that should work as you describe?

Do you have access to Matlab to compare and show whether they work one way or
the other?

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?49169>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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