Scheme mico (was Re: Python mico)



> We *still* need somebody to write the scheme bindings. Any takers? 
> 
> As far as I know, Elliot is looking into doing C bindings to omniorb
> (since this is much faster than mico and the two interoperate well), and
> Owen Taylor is playing with perl bindings for mico.


Hi,

I had a closer look at Mico and its DII. I think there are two different
approaches to implement Scheme bindings/mapping:

Version 1:

 Do it via IR and DII as the mico IR-Browser does. It should work like
 this then:

 (load-from-ir "gimp")
 (let ((gimp (find-in-imr "gimp")))
  (new-image gimp 300 200 'color)
  )

 or maybe like this:

 (let ((gimp (find-in-imr-and-ir "gimp")))
  ((gimp 'new-image) 300 200 'color)
  )

 This approach also makes it possible to write a CORBA server in Scheme.
 As it is possible to register an interface in the IR without having registered 
 an implementation in the IMR (see ir/main.cc), implementing a server could 
 work like this:

 shell> idl2ir account.idl

 Server in Scheme:

 (load-from-ir "account")
 ; here we need some kind of object system for Scheme (yasos?), that
 ; must be able to do separate declaration and definition of object methods:

 (define-object-method (account 'withdraw amt)   ; declaration would be done
    (set! amount (- amount 1)))                  ; in load-from-ir before.


Version 2:

 Do a separate IDL to Scheme mapping via an IDL-Compiler, as with C or C++.


IMHO Version 1 has many advantages. First of all it is very easy to use! Most
people won't even recognize the difference between local objects and CORBA
objects! Second it shouldn't be difficult to implement. Only a good object 
system for Scheme is a must! The code how to do DII on an Object, whose
Interface was loaded from the IR is already done - the IR-Browser from mico
(ok most of it is in java, but it shows how to go)!

Of course a mix of both methods is possible: make Clients with Version 1 and
Servers with Version 2. This might be the best solution, because no separate
declaration and definition of objects/methods is necessary in order to
implement an interface for a Server - you just would have to fill out the
skeleton provided by the idl to Scheme compiler. Clients can still use
the IR/DII approach.

What do you think?

-- 
Jan Kautz
WWW: http://wwwcip.informatik.uni-erlangen.de/user/jnkautz/
EMail: jnkautz@cip.informatik.uni-erlangen.de



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]