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

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

[Octave-bug-tracker] [bug #45503] Saved function handles may be incorrec


From: asherikov
Subject: [Octave-bug-tracker] [bug #45503] Saved function handles may be incorrect
Date: Thu, 09 Jul 2015 15:41:30 +0000
User-agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36

URL:
  <http://savannah.gnu.org/bugs/?45503>

                 Summary: Saved function handles may be incorrect
                 Project: GNU Octave
            Submitted by: asherikov
            Submitted on: Thu Jul  9 15:41:29 2015
                Category: None
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 3.8.1
        Operating System: *BSD

    _______________________________________________________

Details:

If a script file contains many functions, they are not properly identified by
their handles stored in a data file.


Example of a script file:
-----
function test_struct = testfcn()
    test_struct.some_function_handle = @some_function;
end

function a = some_function()
    a = true;
end
-----

It can be used as
-----
a = testfcn();
a.some_function_handle(); % returns 'true'
-----

However, after the structure 'a' was saved and loaded, the function handle is
not restored properly
-----
save a.mat a;
load a.mat;
a.some_function_handle(); % now calls 'testfcn()' instead of
'some_function()'
-----

Contents of the data file:
-----
# name: a
# type: scalar struct
# ndims: 2
 1 1
# length: 1
# name: some_function_handle
# type: function handle
# octaveroot: /usr/local
# path: /usr/home/aleks/testfcn.m
some_function
-----




    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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