Version française
Home     About     Download     Resources     Contact us    
Browse thread
Desktop GUI toolkits - current state of the art?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Alain Frisch <alain.frisch@l...>
Subject: Re: [Caml-list] Desktop GUI toolkits - current state of the art?
On 11/24/2010 10:47 AM, Martin DeMello wrote:
> No, I'm on linux, but CSML does look very interesting. Does it work
> well with Mono?

Yes, CSML itself has been adapted to work with Mono and I did a few 
tests (some of screenshots show Windows Forms GUIs controlled by OCaml 
code, under Linux with Mono). External users reported successful uses as 
well.

At some point, we tried to run our main application under Mono (the 
application is mostly OCaml, plus a very small amount of C#, and a lot 
of CSML to make big parts of .Net libraries available to OCaml). We 
quickly realized that some widgets which we use a lot in our application 
simply don't work very well under Mono. For instance, the
WebBrowser control is quite broken under Mono. This really has nothing 
to do with CSML, it's just that relying on Mono only to get nice GUIs 
under Linux might not be optimal.

> I'd love to read that when you do. I was surprised not to see much
> interest in GUI DSLs in OCaml. What is generalised recursion?

Being able to write things like:

lazy let rec button1 =
   button ~click:(fun () -> button2 # disable) "Button1"
and button2 =
   button ~click:(fun () -> button1 # disable) "Button2"
in
...


As the lazy keyword suggests, we rely on lazy evaluation to evaluate 
such recursive definitions. The code above is equivalent to:

let rec button1 =
   lazy (button ~click:(fun () -> (Lazy.force button2) # disable) "Button1")
and button2 =
   lazy (button ~click:(fun () -> (Lazy.force button1) # disable) "Button2"
in
...

(also replacing any instance of button1, resp. button2 in ... by 
Lazy.force button1, resp. Lazy.force button1).


The little extension makes it easier to define in a single big
recursive definition several widgets with associated callbacks
and mutual interactions. Without the feature, the natural thing to do
is to create widgets first and then bind events, which looks less 
functional (and less local).


Alain