|
|
Label: ♦bug report
♦english
Nightwalker
created at Friday, 2010-03-26, 20:35:40
8 Replies, 2925 Hits
routine proc(x = {0, 1}, i = 0)
{ io.writeln(i); } proc(); # outputs '{0, 1}' instead of '0' routine proc2(x = {0, 1}, i = 1) { io.writeln(1); } proc2(); # outputs '?' routine proc3(x = {0, 1}, i: int = 1) { io.writeln(i); } proc3(); # outputs '0' instead of '1' routine proc4(x = {1, 1}, i: int = 1) { io.writeln(i); } proc4(); # causes error '1, invalid parameter list'
const constList = {0, 1};
routine proc(x = constList, i = 0) { io.writeln(i); } proc(); # all works fine
routine proc(x = null, i = 1)
{ io.writeln(i); } proc(); # outputs ‘0’ instead of ‘1’
class X
{ class Y { var yMember = 0; } var inner: Y; routine X() { inner = Y(); } operator .member=(value: int) { inner.yMember = value; } } class Z: X { routine Z(): X(){} } z = Z(); z.member = 1; # here error ‘ErrorFieldNotExist: yMember’ is raised
class X
{ class Y { var yMember = 0; } var inner: Y; routine X() { inner = Y(); } routine getInner() { return inner; } operator .member=(value: int) { getInner().yMember = value; # using a mediator } } class Z: X { routine Z(): X(){} } z = Z(); z.member = 1; # works fine
arr = [1 : 5];
apply(arr) -> |x, i|{io.write(i, ' ')}; # outputs 5 zeros
use mtlib;
routine proc() { io.writeln('within a thread'); } t = thread(proc); # raises ‘thread, invalid parameters for the call’
x = routine(){io.writeln('x');}; # raises ‘inconsistent typing’
x(); # crashes
x = 0;
y = 1/x;
routine a(){return 0;};
io.writeln(a()); # nothing happens (no output)
Comments
fu commented at Sunday, 2010-03-28, 03:33:38
I have spent some time to fix some of the bugs in Qt dynamic form loading. Now it allows deriving from QUiLoader and re-implement the createWidget() method to create customized loader. I tested the following example with Qt4.6.2 on MacOS 10.5, it is reasonably working:
load DaoQtCore;
However, I didn't do extensive testing yet, but this fixing should also fix some other bugs that are due to improper wrapping code generation. I haven't try to fix the problem of casting from QWidget to other widget types, this will soon be fixed. The problem with the returned object of QObject::children should also be fixable.load DaoQtGui require DaoQtCore; app = QApplication( 'test' ); file = QFile( 'test/daoAbout2.ui' ); file.open( QFile::ReadOnly ); class MyDialog : QDialog { sub MyDialog( parent : QWidget=0 ) : QDialog( parent ){} } class MyUiLoader : QUiLoader { sub createWidget( className : string, parent : QWidget=0, name : string='' ){ if( className == 'MyDialog' ){ return MyDialog( parent ); } return ((QUiLoader)self).createWidget( className, parent, name ); } } loader = MyUiLoader(); win = loader.load( file ); win.show(); app.exec(); You may find the new bindings for Qt4.6.2 (only QtCore and QtGui at this moment) at: http://code.google.com/p/daoqt/source/browse/#svn/trunk/DaoQt4.6 I will also look into the rest of bugs you reported, the updates will be committed to the svn repository of Dao on Google Code, as soon as fixing become available.
fu commented at Sunday, 2010-03-28, 07:43:44
This bug is caused by improper mapping of self-object for class operator method calls, namely the z object was not mapped from class type Z to class type X when .member=() of X is called. Now it is fixed and updated to the svn repository.
fu commented at Sunday, 2010-03-28, 08:32:33
arr = [1 : 5];
Here arr was actually treated as a 2-dimensional matrix, with row dimension equal to 1. And the index variable i referred to the index in row which is always zero, only using a second index variable can access the proper index value.apply(arr) -> |x, i|{io.write(i, ' ')}; # outputs 5 zeros Now it is fixed such that, for vector, both the first and second index variable (if used) in the apply()->|,| structure will refer to the proper index values. So the above codes will print out proper indexes.
fu commented at Monday, 2010-04-05, 01:50:32
fu modified at Tuesday, 2010-04-06, 03:29:04
use mtlib;
routine proc() { io.writeln('within a thread'); } t = thread(proc); # raises ‘thread, invalid parameters for the call’ Actually this is not a bug, the reason that this will raise an exception is that thread() is a method that requires a self parameter which should be mtlib . So the correct way to call thread() here after the use mtlib is:
t = thread( mtlib, proc );
The same holds for other methods that require a self parameter.
fu commented at Monday, 2010-04-05, 02:01:37
The bug with list as default parameter values is caused by improper compiling.
And the bug with null as default parameter value is caused by improper passing
default parameter values at running time, where the default values after a null
default value are not passed.
Now they are fixed and updated into the svn repository on google code.
fu commented at Tuesday, 2010-04-06, 07:17:41
x = routine(){io.writeln('x');}; # raises ‘inconsistent typing’
x(); # crashes This is the result of a bug in handling the abstract types of routines. Now it is fixed (r20 in svn).
fu commented at Friday, 2010-04-09, 02:59:57
fu modified at Sunday, 2010-04-11, 01:02:45
This bug is caused by the fact that the main thread may finish sooner than a child thread, so it may happen that the main thread have done clean up to free some data structures that may still be need by those unfinished children threads. As a result, if there are "un-joined" thread running when the main thread reached the end, it always crashes. Sometimes, the children threads are finished, but the buffered output are not completely printed out before the program end, this might be the situation you thought to be silent crash.
Now this bug is fixed (in revision r24) by letting the main thread to wait for un-joined threads, and print out a warning message saying that there are un-joined threads. Also fixed a potential bug in thread creation.
fu commented at Sunday, 2010-04-11, 17:57:09
fu modified at Sunday, 2010-04-11, 17:57:41
Now a static method qobject_cast() is added to each type derived from QObject ,
so that, X.qobject_cast( Y ) or X::qobject_cast( Y ) will cast type Y to
type X , just in the same way as qobject_cast<X*>(Y*) in C++.
Moreover, the binding codes are improved such that, for QObject or its derived class, say X and Y , where Y is a parent class of X , if X is created in Dao codes, and passed to C++, and then passed back to Dao as type Y , you still get a X , namely it will retain it precise type information. So in the mentioned example,
load DaoQtCore;
If MyDialog is the top level widget used in daoAbout2.u ,
loader.load( file ) will return a type of QDialog instead of QWidget ,
to convert to MyDialog , one can simple do casting,
load DaoQtGui require DaoQtCore; app = QApplication( 'test' ); file = QFile( 'test/daoAbout2.ui' ); file.open( QFile::ReadOnly ); class MyDialog : QDialog { sub MyDialog( parent : QWidget=0 ) : QDialog( parent ){} } class MyUiLoader : QUiLoader { sub createWidget( className : string, parent : QWidget=0, name : string='' ){ if( className == 'MyDialog' ){ return MyDialog( parent ); } return ((QUiLoader)self).createWidget( className, parent, name ); } } loader = MyUiLoader(); win = loader.load( file ); win.show(); app.exec();
dialog = (MyDialog) win;
(This require to use the latest version (r29) of Dao from the svn repository)
Here, such casting is permitted, because this dialog widget is created in MyUiLoader:: createWidget() by,
if( className == 'MyDialog' ){
In this way, a Dao object of MyDialog is created, and this Dao object has a parent object that
is the type of QDialog , which is then passed back to Dao by,
return MyDialog( parent ); }
win = loader.load( file );
Since win retains its precise type information, casting it to MyDialog becomes valid. |
fu: ... I forgot to say something about the plan for the whole new year in my previous reply. Well, besides w ... (Jan.19,01:40) fu: ... Happy new dragon year (which will start from this sunday)! Actually, it was a busy month (I wish th ... (Jan.18,22:46) ybabel: What's the plan for the new year ? Hello 'vry budy :- ) happy new year (when is the new year for you Fu ?) I saw you come back and comm ... (Jan.18,18:59) |