PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Fix this bug today and make this topic go away :)

Here is the example:
Code:

#class TTestClass //Class which will be stored in List.
public(
a$
);

public nproc Create
a$ = 100;
end;

public func getA()
return (a$);
end;

public proc setA(_a$)
a$ = _a$;
end;

public proc ShowA()
showMessage(str(getA()));
end;

#endClass


#class TPreTest //test with simple list of Objects
public(
l$
);

public nproc Create
list(l$);
for (i$, 0, count(args$) - 1)
add(l$, args$[i$]);
end;
end;

public proc ShowList()
s$ = "";
foreach (l$)
s$ += " " + str(l$);
end;
showMessage(s$);
end;

public proc TestObj()
last(l$);
TTestClass(p$);
&p;$ = l$;
p.showA();
end;
#endclass



#class TTest //Test with the list of arrays :(
public(
l$
);

public nproc Create
list(l$);
add(l$);
dim(l$, count(args$));
for (i$, 0, count(args$) - 1)
l$[i$] = args$[i$];
end;
end;


public proc ShowList()//shows the first elem of our list
s$ = "";
for (i$, 0, vmax(l$) - 1)
s$ += " " + str(l$[i$]);
end;
showMessage(s$);
end;

/*
Here we test the object in the list
(which is the list of arrays)
*/
public proc TestObj()
TTestClass(p$);
&p;$ = l$[vmax(l$) - 1];
p.showA();
end;

#endclass



proc Main
#object TTestClass inListObj$;

//simple test that works fine
inListObj.setA(40);
#object TPreTest obj$(1, 2, 3, inListObj$);
obj.ShowList();
inListObj.setA(80);
obj.TestObj();

//BUT... this way it doesnt work
inListObj.setA(40);
#object TTest obj1$(1, 2, 3, inListObj$);
obj1.ShowList();
inListObj.setA(80);
obj1.TestObj();

end;

Hi Dragnir,

I will look at it tomorrow and fix it! There will be a new version out on friday.
Btw,
atan2(2,4); //=>invalid number of input parameters error
I'll fix that too! ;)
not BTW:
Code:

#class Ttest
public(
name$
);
public nproc Create
name$ = args$[3];
//I suppose we have the string itself here not its address?
//cause if we put name$=@args$[3] =>address misAligned error
end;

public func GetName()
return (name$);
end;

public func setname(nam$)
name$ = nam$;
end;
#endclass

proc main
#object Ttest obj$(3, 4, 5, "Some_string", 4);
showMessage(obj.getName()); //here - shows string
//The bug:
showMessage(obj.getName()); //but..here - it doesnt.
end;

Ok, the three bugs have been fixed. Your code will work with the new version tomorrow.

Thanks for your patience.