FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Dynamic DUI

 
Post new topic   Reply to topic     Forum Index -> gtkD
View previous topic :: View next topic  
Author Message
JJR



Joined: 22 Feb 2004
Posts: 1104

PostPosted: Tue May 03, 2005 2:48 am    Post subject: Dynamic DUI Reply with quote

Well this is getting to be a excessively frustrating. I thought I was getting somewhere, but now I realize I'm getting hopelessly confused with the way DUI works.

First off, I've succeeded in getting a dynamic loader operational for DUI. It loads up all the necessary gtk, gdk, gobject, glib, pixbuf, and pango symbols for the DUI widgets at DUI application runtime.

At the moment, I'm trying to get the symbols integrated with the DUI project. This is a whole lot tougher than I thought, and I ended up having to rearrange several things in DUI to get it "kind of" working. I'm using the latest dool update with the fixup.

Issue number 1 is this: I'm getting Access violations during program execution during the widget setup phase (HelloWorld.d DUI sample). I've peppered the source with debug printf's and have narrowed down the general location of the problem, but the problem is so bizarre that I'm confused at what to do. The major part of the issue is that DUI has adopted the style of class-local imports. This is a well known dangerous practice because of D's infamous name resolution rules. Ant, I'm not sure why you are still doing this. It makes the source extremely difficult to troubleshoot.

For example, in this case, I was exceedingly surprised to discover that the getAutoShow() method, the source of much of my confusion, was returning a consistantly invalid value from within a constructor. It took a whole lot of digging to realize that the only getAutoShow() method in Widget was not being called at all! Widget does not inherit another getAutoShow so I was completely baffled as to why it kept returning a false value. I should have known better: I recall the agonizing that Kris and I had over a similar bug in mango about a year ago.

So I decided to make a quick search for other getAutoShow() methods in other DUI files. The only other one was in dui/Window.d. Widget does not inherit from Window.d. But it does import the Window.d module inside the class. An amazing thing happens now due to this intra-class import: Widget's getAutoShow method is miraculously overridden by the imported Window's getAutoShow. Even worse, Window.getAutoShow uses the override keyword which causes even more bizarre control of Widget's getAutoShow: try to rename the method in Widget, and you find that the Window getAutoShow demands that override be honored in the Widget module... even though it doesn't even inherit from it!

This was just one source of the errors. It still doesn't completely explain why I'm getting an Access Violation on Winxp. I'm able to get to the point where a window briefly flashes on the screen, but it disappears again in nanoseconds followed by the boring Access Violation message

These local imports also have a bizarre affect on the whole DUI structure. Widget also imports the event system inside the class. This includes a whole bunch of templates. If I try to move the event system imports outside the class, a whole bunch of errors occur across a whole bunch of files. If I try to move the template and imports outside the class, more happens. The web of dependency has already been weeved together in this project.

All I can say is that I think we should absolutely, positively stay away from class-local imports. It's evil, evil, evil as long as Walter believes in his name-lookup rules, and this style is well known to cause too many hard to find bugs due to name hiding. I don't think I can do much more for dynamic system for DUI in it's current state. I really thought it would be great because it simplifies app programming with DUI greatly, but I'm in over my head when comes to sorting out the library's organization.

Sad

-JJR
Back to top
View user's profile Send private message
Ant



Joined: 06 Mar 2004
Posts: 306
Location: Canada

PostPosted: Tue May 03, 2005 5:58 am    Post subject: Re: Dynamic DUI Reply with quote

JJR wrote:
Widget's getAutoShow method is miraculously overridden by the imported Window's getAutoShow.


Sorry if all this is in reply to your post John, you have been one of the nicests people around! Thank you for all your support.

Can this be a bug on DMD windows?
DUI works fine on linux but I do have 'Access violation' on Windows 2000 and the HelloWorld doesn't run.
The installer starts until it runs into AA where it gets 'Access violation' again.
Try to report this. Last time I spend 2 hours tracking down a problem I got completly ignore on the bugs groups - no more.

The reason I started to use imports in the class body was to avoid forward reference problems.
The reason I started dool was to avoid the stupid name resolution on D.
(I waited a long time for Walter to correct the problems before comming with these 2 solutions).
My value (karma, ...) on D forums now is close to 0 (but comming from the other direction) I can't say a thing that people pay attention.

Starting to move the imports to outside the class body will be a big task and I'm afraid will show other D limitations.

Widget will issue events - Widget needs to import Events.
Event need to reffer back the Widget that generate them - Events need to import Widget.
Is that Allowed on D?

As I said before I spend more time fighting DMD then actually use it - this is true, it's not a joke.
maybe it's time to try to move the imports back to the module level.
I wish Walter would comment on the imports but he can't be bodered, not now, not a year ago when I first asked.

One thing I learn from D: Never, ever again invest on a project lead by one person alone!
Of course DUI is one man job also, so my advice to you is don't touch it!, at least until more developers get interested on it.

Finally on the D news group Derek was brave enough to to use the 'stupid' word refering to a D feature I hope Walter sees that and reflects on it.

Don't worry, I'm still very interested in developing DUI I just don't have time right now - but my kitchen and upstairts floors look gorgious - next is the basement - If I got money for DUI I could contract some one to do my floors - As I said before, there is no such thing as free software: I'm paying for DUI, I'm paying for the entire community to use it.

Unfortunatly his post does reflects my corrent actitude towards D, Walter and the D community.

You might have notice I'm abstaining as much as possible from posting on the D groups, but this is my project group :)

Ant
Back to top
View user's profile Send private message
JJR



Joined: 22 Feb 2004
Posts: 1104

PostPosted: Tue May 03, 2005 8:32 am    Post subject: Reply with quote

Wow! Thanks, Ant, for that long and detailed reply. Smile You've spoken very honestly and for that I'm very thankful: it's hard to get that kind of answer from people these days. I completely understand your perspective and thank you for your insight.

I may give it a few more tries as I find time, but my feelings about dmd have much the same direction as you. I keep coming back because there's so much I'm interested in doing and learning, but, in the long run, the progress in the language is disturbingly slow.

Please forgive my post above; it was a bit of a rant of exasperation. I remember the forward reference problems well and the reasons for moving the imports locally to begin with. I may try to start moving them out to see if things work again with enough manipulation.

Congrats on the home improvements... such things are much more worthwhile and appreciable than things in the programming world. Smile

And once again, welcome to Canada! Feel free to drop me an email from time to time, or if you're nearby, a visit Smile.

-JJR
Back to top
View user's profile Send private message
h3r3tic



Joined: 30 Mar 2004
Posts: 261
Location: Torun, Poland

PostPosted: Tue May 03, 2005 9:14 am    Post subject: Re: Dynamic DUI Reply with quote

Ant wrote:

Widget will issue events - Widget needs to import Events.
Event need to reffer back the Widget that generate them - Events need to import Widget.
Is that Allowed on D?


Unless these modules have static initializers, it's perfectly allowed. I'm using this feature in my project.
In my case gui.widget imports gui.container and gui.container imports gui.widget. No problems with that...

// Hope this can be of some help Smile

</Tom>
Back to top
View user's profile Send private message MSN Messenger
JJR



Joined: 22 Feb 2004
Posts: 1104

PostPosted: Tue May 03, 2005 2:21 pm    Post subject: Reply with quote

Thanks Tom,

These particular modules don't have static initializers, although I have a separate loader module that does.

It should work somehow... It will just take a fair bit of unravelling to figure out.

Thanks for the tip!

-JJR
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> gtkD All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group