[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
More subfunction scoping issues.
From: |
David Bateman |
Subject: |
More subfunction scoping issues. |
Date: |
Fri, 30 Mar 2007 18:01:58 +0200 |
User-agent: |
Thunderbird 1.5.0.7 (X11/20060921) |
John and All,
John recently introduced a number of fixes for subfunction scoping
issues, that vastly improvement the compatibility between octave and
matlab. However, there remains a few issues that need to be addressed to
get the compatibility to be 100%. Consider the test function
function toto2 ()
x = toto(23)
x.titi(1)
x.titi(1)
x.titi(1)
x.tata()
x.c
end
function y = toto (a)
y.titi = @titi;
y.tata = @tata;
y.c = 1;
function p = titi (q)
p = q + a;
a = a + y.c;
y.c = y.c + 1;
end
function z = tata()
z = tutu();
function z = tutu ()
z = y.c;
end
end
end
which tries to demonstrate a number of these scoping issues. Which
R2006b I get
x =
titi: @toto/titi
tata: @toto/tata
c: 1
ans =
24
ans =
25
ans =
27
ans =
4
ans =
1
Of course with octave it crashes on the first call to "titi" as the
variable "a" that is in the scope of the parent of titi is not visible
in the scope of titi. What would be needed to fix this issue, as I've
just been given a large chunk of matlab code that relies on these
scoping rules? So if the effort isn't much I wouldn't mind attacking
this issue rather than modifying the code I've been given to allow
easier exchange with the people giving me the code.
Regards
David
--
David Bateman address@hidden
Motorola Labs - Paris +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin +33 6 72 01 06 33 (Mob)
91193 Gif-Sur-Yvette FRANCE +33 1 69 35 77 01 (Fax)
The information contained in this communication has been classified as:
[x] General Business Information
[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary
- More subfunction scoping issues.,
David Bateman <=