Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] productivity improvement
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-07-12 (17:36)
From: Eray Ozkural <erayo@c...>
Subject: Re: [Caml-list] OCaml QT bindings
On Friday 12 July 2002 11:10, Stefano Zacchiroli wrote:
> On Fri, Jul 12, 2002 at 04:41:36AM +0300, Eray Ozkural wrote:
> > > Ohhhh.. just imagine if GTK/Gnome/Gui stuff on RH linux
> > > were written in Ocaml .. it might actually work!
> >
> > You guys really need my ocaml bindings for Qt/KDE (assuming I finish
> > writing it....) ;)
> Yup!!! I've been wondering for such a binding for months .... (anyway
> the impressive work to build up one stops me from starting the work :-),
> could you tell us when you expect to have a working version?
> BTW, obviously if you need help, feel free to ask!

I think I will need help. The ocaml type system makes it very easy to get it 
right at the abstraction level but the mundane work of providing entry points 
for all Qt classes itself is not an easy task since you need a successful 
translator, or you will have to correct things by hand which is highly 

I'm right now at the stage of writing a C++ parser that will be sufficient for 
header files in KDE. The parser isn't finished yet, but I've based it on a 
grammar which targeted part of the ISO standard so when it's done I think it 
will be worthwhile.

Since I'm fond of parser combinators I'm writing the translator in Haskell 
language using Parsec library.

I've thought about what should be involved in the library and it seems at 
least the following will be necessary:

1) "C" bindings which will be entry points for constructor/destructor, member 
functions and selector/modifier functions for each member variable in each Qt 
class... This will abstract away C++ dispatch, inline, etc. Template 
functions will not be addressed. (But it will not be a problem to implement 
things like QStringList which inherit from template classes....)

2) A mapping of class inheritance and subtyping relations to ocaml classes. 
This should be relatively straightforward since ocaml type/class system 
covers a lot more ground than C++.

3) A mapping of parameter passing, and "new" / "delete" to ocaml. We're 
passing mostly plain pointers/references in Qt, but I think there are cases 
where this is not true. The object model would be taken akin to Java where 
each object is allocated on the heap to simplify this matter.

Optionally, I will see if I can come up with some ocaml code that will provide 
high level access to GUI code.

The help I can use now is: do you observe any difficulties with the approach I 
have roughly outlined? And are there any vital points that I seem to be 


Eray Ozkural (exa) <>
Comp. Sci. Dept., Bilkent University, Ankara
www:  Malfunction:
GPG public key fingerprint: 360C 852F 88B0 A745 F31B  EA0F 7C07 AE16 874D 539C

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: