Re: [GUI] Proposal Proposal: haskell-gui addendum to haskell standard

Dear all, I would like to elaborate on a number of things that have been said recently about Object I/O (be it in Clean or Haskell). Object I/O has been designed to be platform independent: it is separated into two layers: one OS dependent layer and one abstract Clean/Haskell layer built on the lower layer. The OS dependent layer has been implemented for the MS Windows platform and we are currently working on a Mac port. Krasimir Angelov has tried to port it to GTK, and says that the OS dependent layer apparantly still has an OS bias that makes it less suitable for GTK. He mentions the following differences: [Krasimir Angelov at: 02:21 20-1-03 -0800] > * The GTK cannot draw rotated text and rotated >elipses. This depend on restrictions imposed from X >server. > * The Win32 backed lack powerful text formating >features like these given from PANGO. > * The Font families given in the GTK and Win32 are >rather different. The font management are still >similar on each platform. * Graphics features will always differ on all platforms. Object I/O anticipates on this by offering an open-ended graphics API. Type classes for drawing and filling (Drawables and Fillables respectively) are defined as well as a limited set of standard instances (lines, curves, rectangles, text). To extend the graphics capabilities one can simply create a new module in which these new instances are declared and implemented. This has for instance been done to extend the graphics library with the ability to render bitmaps. * I don't see why one would need these text formatting features in this context. Perhaps Krasimir can explain this? * Font family naming conventions already depend on the particular set of installed fonts on a machine. A decent program can therefore never assume the existence of whatever font, and it should try to find out this information via the OS. I would certainly not be surprised if the OS dependent layer of Object I/O indeed has an OS bias, but the above points don't seem to be problematic to me. Please note that I have no experience with Gtk. However, for an old version of Object I/O we have had a Master Thesis project porting it successfully to X Windows (using the OpenLook toolkit). My guess is that Gtk is inspired by the X Windows approach. Again, Krasimir can elaborate on this. One big advantage of a two-layered approach is that applications can have a native look-and-feel. Although I am perfectly aware of the burden of keeping ports up-to-date, I think it is very important that applications written in the "standard" GUI library for Clean/Haskell behave as others. People (even scientists) do get annoyed when confronted with applications that do not conform to the normal behaviour. The two-layered approach also does not exclude a port to a platform indepent toolkit, so that might serve as a starting point. Finally, a well-documented and well-defined OS dependent layer will ease the development of high-level GUI libraries. Researchers will not need to re-invent the wheel and see the result of their implementation effort more quickly. [Axel Simon at: 14:45 23-1-03 +0000] >Dialogs in Windows are specified in dialog units, i.e. they scale with the >font size but cannot be resized by the user: scrap Gtk's dynamic sizing >capability. Buttons on Aqua cannot have icons in them, scrap icons in Gtk >and Windows button. Scrap Aquas hierarchical view in several columns >(could be simulated if Windows supports adding columns on the fly, Gtk >would), scrap additional columns next to a hierarchical tree since Windows >doesn't support that. Scrap Window's concept of groups in dialog and >keyboard accelerators in general since Aqua doesn't know about hotkeys. >AFAIK a lot of UI elements on Windows which are considered "standard" are >implemented in the Microsoft Foundation Classes. Thus to actually use >these, one has to use the MFC written in C++ (or .net). This has partially been answered by Krasimir. In addition, I would say that the answer to these differences is abstraction. As an example, consider resizing of controls. In Object I/O, a control can have a resize attribute that defines its size in terms of the size of (one of) its parent(s). When put in a resizeable parent object that is resized, it will resize according to its attribute. If the platform does not allow resizeable dialogs/windows, then that is no problem. Similar to icons in buttons: add an attribute to specify the icon in a button and if the platform does not support it, you don't show it. No scrapping needed; good set of attributes and semantics needed. [Sengan.Baring-Gould at: 13:21 22-1-03 -0700] >While programming at the IO level works, it does not give one >much of an advantage versus programming in C, in sharp contrast >to most other Haskell programming. > >The diversity of high level solutions which differ totally in >outlook ("express the widget as a datastructure" versus >"everything is a composition of functions") gives the impression >that the library designers never used their toolkits in larger >applications which would have made any rough edges painfully obvious. >It seems therefore that a lot more work needs to go into this field >before we know what a good high level Functional GUI toolkit looks like. >Contrast this with more mature fields such as pretty printing, >parsing, etc where there are many solutions all following the same >ideas. I don't agree with the "does not give one much of an advantage versus programming in C". Many proposals have been written that make use of the elaborate type system of functional languages to glue correct GUI programs; many approaches use functional language features do construct well-typed and well-structured Domain Specific Languages. "...the library designers never used their toolkits in larger applications..." True: I didn't, but other people have. Check out the CleanIDE (by Diederik van Arkel): http://www.cs.kun.nl/~clean/About_Clean/body_the_clean_ide/body_the_clean_ide.htm and the beautiful Sparkle Proof Tool (by Maarten de Mol): http://www.cs.kun.nl/~maartenm/Sparkle/ Regards, Peter

On Fri, 24 Jan 2003 11:48:32 +0100
Peter Achten
Similar to icons in buttons: add an attribute to specify the icon in a button and if the platform does not support it, you don't show it. No scrapping needed; good set of attributes and semantics needed.
I agree on this position, which has not been mentioned until now in this discusion. But the developer must be aware of this, maybe with a particular naming convention on non-universal features, so one can safely write a program, not using these features, and know that it will look good on other OS'es without the need to test it. Imagine if one does not know that buttons don't show images on OSX and writes an applications with only images in buttons. On a mac it would look like a ridicolous empty-button joke :) Vincenzo -- First they ignore you, then they laugh at you, then they fight you, then you win. [Gandhi]

--- Peter Achten
Krasimir Angelov has tried to port it to GTK, and says that the OS dependent layer apparantly still has an OS bias that makes it less suitable for GTK. He mentions the following differences:
[Krasimir Angelov at: 02:21 20-1-03 -0800]
* The GTK cannot draw rotated text and rotated elipses. This depend on restrictions imposed from X server. * The Win32 backed lack powerful text formating features like these given from PANGO. * The Font families given in the GTK and Win32 are rather different. The font management are still similar on each platform.
The differences aren't mentioned in relation with ObjectIO. This is simple a list of differences which I found during development of HToolkit. The HToolkit low level uses a pieces of C code which was initially written for ObjectIO. When tried to extend drawing primitives offered from ObjectIO I found these limitations. I don't think that this is problematic.
* I don't see why one would need these text formatting features in this context. Perhaps Krasimir can explain this?
I just mentioned this to be exhaustive.
* Font family naming conventions already depend on the particular set of installed fonts on a machine. A decent program can therefore never assume the existence of whatever font, and it should try to find out this information via the OS.
I am completely agree. This is the usual behaviour which application can have.
The two-layered approach also does not exclude a port to a platform indepent toolkit, so that might serve as a starting point.
Absolutely. I think that it is easy to build Port and HToolkit under Windows using GTK.
Finally, a well-documented and well-defined OS dependent layer will ease the development of high-level GUI libraries.
This was the main goal to split HToolkit in two parts: Port and HToolkit. Thanks to Daan Leijen for Help. Over the Port library someone can implement implement another high-level libraries (maybe like ObjectIO).
Dialogs in Windows are specified in dialog units, i.e. they scale with the font size but cannot be resized by the user: scrap Gtk's dynamic sizing capability. [cut] This has partially been answered by Krasimir. In addition, I would say that
[Axel Simon at: 14:45 23-1-03 +0000] the answer to these differences is abstraction. As an example, consider resizing of controls. In Object I/O, a control can have a resize attribute that defines its size in terms of the size of (one of) its parent(s). When put in a resizeable parent object that is resized, it will resize according to its attribute. If the platform does not allow resizeable dialogs/windows, then that is no problem.
The dialogs/windows can have IsResizeable attribute which will specify whether the window can or cannot be resized. The default value for this attribute will depend on OS. For windows the default will be true under both GTK and Windows, but for dialog will be true under GTK and false under Windows. Cheers, Krasimir __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com

Peter Achten wrote: (that Sengan said:)
"...the library designers never used their toolkits in larger applications..." True: I didn't, but other people have. Check out the CleanIDE (by Diederik van Arkel): http://www.cs.kun.nl/~clean/About_Clean/body_the_clean_ide/body_the_clean_id... and the beautiful Sparkle Proof Tool (by Maarten de Mol): http://www.cs.kun.nl/~maartenm/Sparkle/
Actually I mentionned Object I/O as the only library with which larger scale applications were written: | Perhaps the best would be to use an Object-IO like interface | with mvars as proposed by Simon Peyton-Jones, simply because it's | higher level than raw gui-calls and the Clean folks have used | it cross-platform in a few real apps. ------------------------------ Another misunderstanding I think:
I don't agree with the "While programming at the IO level works, it does not give one much of an advantage versus programming in C". Many proposals have been written that make use of the elaborate type system of functional languages to glue correct GUI programs; many approaches use functional language features do construct well-typed and well-structured Domain Specific Languages.
By Programming at the IO level I meant stuff like: win <- windowNew WindowDialog windowSetTitle win "About BoolEd" containerSetBorderWidth win 10 -- frame <- frameNew "The Boolean Editor" frameSetShadowType frame ShadowEtchedOut -- label <- labelNew "..." labelSetLineWrap label True labelSetJustify label JustifyFill containerAdd frame label -- but <- buttonNewWithLabel "Ok" buttonSignalConnectObject but (ButtonClickedHandler widgetDestroy) win -- box <- vBoxNew False 0 containerAdd win box boxPackStart box frame True True 10 boxPackStart box but True False 10 Not the Object IO style of building a layout with :+: combinators.
participants (4)
-
Krasimir Angelov
-
Nick Name
-
Peter Achten
-
Sengan.Baring-Gould@nsc.com