QtD 0.1 is out!
Max Samukha
samukha at voliacable.com.removethis
Mon Feb 16 01:46:55 PST 2009
On Sun, 15 Feb 2009 21:27:35 -0500, Eldar Insafutdinov
<e.insafutdinov at gmail.com> wrote:
>Eldar Insafutdinov Wrote:
>
>> Max Samukha Wrote:
>>
>> > On Mon, 16 Feb 2009 03:55:58 +0900, Bill Baxter <wbaxter at gmail.com>
>> > wrote:
>> >
>> > >On Mon, Feb 16, 2009 at 3:28 AM, Max Samukha
>> > ><samukha at voliacable.com.removethis> wrote:
>> > >> On Sun, 15 Feb 2009 13:06:46 -0500, Eldar Insafutdinov
>> > >> <e.insafutdinov at gmail.com> wrote:
>> > >>
>> > >>>Finally we managed to compile qtd for Windows. But at the very last step when compiling example, optlink crashed with a messagebox containing X86 registers content. This seems to be a blocker for qtd working on windows..
>> > >>
>> > >> This may be related to the famous
>> > >> http://d.puremagic.com/issues/show_bug.cgi?id=424, though we don't
>> > >> make extensive use of templates.
>> > >
>> > >It can also happen because of a single very large file. Perhaps one
>> > >created by some sort of automatic code generation. Anything like that
>> > >in qtd?
>> > >
>> > >--bb
>> >
>> > Yes, all modules are autogenerated. You are right, we probably should
>> > think about splitting up that big file. For example, by placing enum
>> > definitions into a separate module. It is still a less preferred
>> > solution because it requires more tweaking of the original code
>> > generator, which is already messy.
>>
>> The reason why is this file is big is in this bug http://d.puremagic.com/issues/show_bug.cgi?id=282 And I don't thing that placing enums outside the class is a good idea, because enums will be exposed to global namespace unlike original Qt version. I have just checked, if enum A belongs to qt.core.Qt module you can't access it like Qt.A - which means that we have to keep that file big until this bug is fixed.
>
You can still alias global enums into the class scope if you want Qt.A
>Anyway, I tried to place enums outside the classes, and I got:
>qt/core/QFile.d(24): Error: enum FileError is forward referenced
>qt/core/QFile.d(24): Error: enum FileError is forward referenced
>qt/core/QFile.d(24): Error: enum FileError is forward referenced
>qt/core/QFile.d(24): Error: enum FileError is forward referenced
>qt/core/QFile.d(24): Error: enum FileError is forward referenced
>qt/core/QFile.d(24): Error: enum FileError is forward referenced
>qt/core/QFile.d(24): Error: enum FileError is forward referenced
>qt/core/QFile.d(24): Error: enum FileError is forward referenced
>
>Circular import is present.
Taking them outside the class doesn't help. I proposed to put them in
a separate module. That would require renaming them to include class
names. Yes, that sucks but it seems there's not much choice.
----
module QFooEnums;
enum QFooState {}
----
module QBarEnums;
enum QBarState {}
----
module QFoo;
import QBar;
import QFooEnums;
import QBarEnums;
class QFoo
{
alias QFooState State; // if you really want to
void bar(QBarState e) {}
}
---
module QBar;
import QFooEnums;
import QBarEnums;
QBar
{
alias QBarState State;
void foo(QFooState e) {}
}
Or put all the enums in a single module (which will result in a big
file but more digestable for optlink)
Btw, circular imports magically erase static constructors from the
menu.
More information about the Digitalmars-d-announce
mailing list