English version
Accueil     Ŕ propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis ŕ jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml ŕ l'adresse ocaml.org.

Browse thread
The Bridge Pattern in OCaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-03-28 (12:43)
From: Jim Farrand <jim.farrand@g...>
Subject: Re: [Caml-list] The Bridge Pattern in OCaml
On 28/03/2008, Oliver Bandel <oliver@first.in-berlin.de> wrote:
> Zitat von Michael Wohlwend <micha-1@fantasymail.de>:

>  Creating a datastrzucture, while creatzing the functionality.
>  And later, when you want to serialize what you have build up,
>  write that datastructure, you build by your own, to a file.
>  and when rereading it, this means: re-create the functionality from the
>  datastructure.
>  Isn't this, what is looked for, here?

Yes, this definitely solves the problem and meets the requirements I specified.

In Haskell, it would be very neat - define a Monad for composing the
ASTs and then code just like you would any other Haskell program,
you're just using a different Monad from normal.

In O'Caml, a lot less neat because the user providing the behaviour
suddenly isn't really coding the algorithm in O'Caml, but creating a
data-structure that represents the computation.

But still, it definitely gets the job done.

>  This is in a way langauge implementation.
>  Isn't it?

Yes, indeed.  I guess that's what makes me hesitate.  When a fairly
simple problem like "allow calling modules to provide custom behaviour
with serialisation" is answered with "implement a sub-language", it
makes me worry that either the language or my design is inappropriate
for the job, especially when other languages solve the same problem
with relative ease.

So I guess, I'm hoping for something more.  :)  (I'm very demanding I
know, but this list regularly puts forward answer of such pure genius
that I figure it's worth asking[1])

Thanks for your thoughts on the issue,

[1] http://ocaml.janestcapital.com/?q=node/18