HOpenGL and --enable-threaded-rts

Wolfgang Thaller wolfgang.thaller@gmx.net
Wed, 19 Jun 2002 10:29:52 +0200

On Mittwoch, Juni 19, 2002, at 01:43 , Andrew J Bromage wrote:

> I don't mean to detract from the fine work which the HOpenGL people
> have achieved, but I think that binding to the C implementation of GLUT
> was, in retrospect, a mistake.

The problem here is with OpenGL, not with GLUT. OpenGL requires some 
thread-local state to be set correctly in order to operate. Surely you 
wouldn't suggest reimplementing OpenGL (plus all OpenGL video drivers 
for every platform/OS/graphics card combination out there) in Haskell?

> Binding to foreign language-specific
> frameworks in general is a mistake, IMO.

I agree that it is difficult, and it can cause headaches. But in order 
to write "real-world" applications in Haskell, there is no way around 
it. In order to write GUI applications, I need a binding to Win32 (a 
"C-specific" framework) for Windows, to Carbon (C-specific) or Cocoa 
(Objective-C or Java) for MacOS X, and to some toolkit for X11 (Gtk, for 
example). Most of those use callbacks of some sort.
It cannot be a "mistake" because it is the _only_ option for achieving a 
certain goal (writing "native" GUI applications for any platform in 

> Today it's only threads which
> you may be able to hack around, but tomorrow, your called-back function
> will want to throw an exception, or something even hairier will turn up
> and you'll be back where you started.

Exceptions just require a little more marshaling, I think. As for the 
even hairier things, I don't think "they" are going to add many more 
crazy things to the C language family, so C-specific frameworks 
shouldn't hold too many surprises in store for us...

> Sorry for the pessimism, but this is bitter experience talking.

Sorry for the optimism, that's just my determination to use OpenGL from 
Haskell talking :-)