Browse thread
The Bridge Pattern in OCaml
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Bünzli_Daniel <daniel.buenzli@e...> |
| Subject: | Re: [Caml-list] The Bridge Pattern in OCaml |
Le 19 mars 08 à 17:29, Christopher L Conway a écrit : > In short, the Bridge Pattern is applicable when a client needs access > to operations F, G which can be provided by a variety of underlying > implementations X, Y, or Z. If the specific implementation isn't > important, you create an interface B (a "bridge") with operations F > and G, and write both the client and the implementations to the > interface B. The client should then be able to access X, Y, or Z > interchangeably, e.g., by taking the implementation as an argument at > initialization. You need existential types. They can be encoded in ocaml, see here [1] the abstract counter datatype that does just what you describe above. Best, Daniel [1] http://caml.inria.fr/pub/ml-archives/caml-list/2004/01/52732867110697f55650778d883ae5e9.en.html