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
OCaml's long range graphical direction?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-02-10 (21:17)
From: Brian Rogoff <bpr@b...>
Subject: Re: OCaml's long range graphical direction?
On Fri, 9 Feb 2001, Jacques Garrigue wrote:
> From: Brian Rogoff <>
> > After all of the admonitions against the use of Obj.magic it's a bit
> > disconcerting to count 41 Obj.magic usages in lablgtk. I recall
> > hearing that that will change. What's the plan?
> Do not forget that any "external" declaration also amounts to an
> Obj.magic, and there are 955 of them in lablgtk.

OK, you're right, I deserved that :-)

> Seriously, most Obj.magic in lablgtk amount to a cast of an external
> after checking its validity, and I see no way to avoid that.

Sure, but it seems to me that even if such things are implemented 
with Obj.magic under the hood we ought to come up with new names and 
eventually move "approved and safe usages" to the Sys module. I am 
probably under the influence of Modula-3 and Ada here...

> What should disappear after ocaml 3.01 is release is the use of
>      external coerce ... = "%identity"
> which is an equivalent of Obj.magic used to go around some limitations
> of the type system. There are 24 of them, but they will not be needed
> anymore thanks to variance annotations in types.

Cool, but you also write in another message 

> The last problem is how to stay type safe when you load a text file.
> Basically this means that you will be more verbose, and that will
> compare badly with guile-gtk or python-gtk based applications.

I think for this problem we need some dynamic typing in the language. It 
seems the Clean and Mercury languages have or will adopt such a solution; 
I don't know about Haskell. This is the same issue as with safe
marshalling right, so we are told that there is some help on the way.  

> So, there might be something to do, but I'm not so much convinced it
> will help with a language like ocaml.

Then ocaml will have to become like something else. It won't be the
first time. 

-- Brian