Subj : Re: wxWidgets To : comp.programming From : Phlip Date : Tue Jul 05 2005 04:21 pm Rob Thorpe wrote: > My point is that it wxWindows would be much more useful if it was a > library providing a set of library calls. That way it could be used > with any language. Object-orientated wrappers could be written for > C++ and other OO languages. Technically, that paragraph betrays the belief that flat API functions are easier to bind to any language than OO objects are. Where this is true (and where we don't need Yet Another ORB-Oriented GUI Toolkit), others have discussed the wrapping issues. When I code in wxWidgets, I think "Ah ha, I'm smarter than all these lessor programmers. They think you 'reuse' an object in OO by inheriting its class! But I'm smart enough to know that most reuse is by delegation, so I won't inherit this Window class, I'l just make it a member of my application object!" Then to do anything with the window, I must override a virtual method. So I must switch to inheritance. That's what you meant by "force the user to use C++ and the object-orientated paradigm". What's really going on here is C++ is not "object oriented" /enough/. The best OO languages support block closures, which are the best way to sink events. I should be able to tell that window's event to call this code block. Without that feature, GUI Toolkits require linguistic hacks to sink events. Some toolkits call callback functions, and some call virtual methods. Either way, we got polymorphism. Someday, we will have an Ultimate GUI Toolkit when we have a cross-language system to permit block closures. Then all GUIs would be sets of library calls, and any language could call them, and sink their events. Flat API functions are stack-oriented. When we invent a block closure system that works at the binary level, the same for every language, then we can have an Ultimate GUI Toolkit. -- Phlip http://www.c2.com/cgi/wiki?ZeekLand .