caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Christopher L Conway" <cconway@cs.nyu.edu>
To: "Bünzli Daniel" <daniel.buenzli@erratique.ch>
Cc: "Caml Mailing List" <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] The Bridge Pattern in OCaml
Date: Wed, 19 Mar 2008 13:44:57 -0400	[thread overview]
Message-ID: <4a051d930803191044t1a1e9cb6h65ddbbda24cd7e1d@mail.gmail.com> (raw)
In-Reply-To: <0A1AD394-2F3B-488E-926B-1839C7C321E6@erratique.ch>

Daniel,

This is very clever! But I might do better to just use objects...

Considering how stylized the declarations are in your example (i.e.,
type 'a t, type 'a t_scope = { bind_t : 'b . 'a t -> 'b }, etc.), I
wonder if one couldn't devise some syntactic sugar?

Chris

On Wed, Mar 19, 2008 at 12:51 PM, Bünzli Daniel
<daniel.buenzli@erratique.ch> wrote:
>
>  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
>
>  _______________________________________________
>  Caml-list mailing list. Subscription management:
>  http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
>  Archives: http://caml.inria.fr
>  Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
>  Bug reports: http://caml.inria.fr/bin/caml-bugs
>
>


  reply	other threads:[~2008-03-19 17:44 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-19 16:29 Christopher L Conway
2008-03-19 16:51 ` [Caml-list] " Bünzli Daniel
2008-03-19 17:44   ` Christopher L Conway [this message]
2008-03-19 18:06     ` Christopher L Conway
2008-03-20  2:07       ` Yaron Minsky
2008-03-20 13:27         ` Martin Jambon
2008-03-20 20:10           ` Christophe Raffalli
2008-03-28 10:44         ` Jim Farrand
2008-03-28 11:06           ` Michael Wohlwend
2008-03-28 11:29             ` Jim Farrand
2008-03-28 11:57               ` Oliver Bandel
2008-03-28 11:30             ` Oliver Bandel
2008-03-28 11:45               ` Jim Farrand
2008-03-28 11:52                 ` Michael Wohlwend
2008-03-28 12:09                   ` Oliver Bandel
2008-03-28 12:43                     ` Jim Farrand
2008-03-28 18:23                       ` Raoul Duke
2008-03-28 18:29                         ` Robert Fischer
2008-03-28 18:34                         ` David Thomas
2008-03-28 19:14                           ` blue storm
2008-03-28 19:04                         ` Oliver Bandel
2008-03-28 19:05                         ` Mathias Kende
2008-03-28 19:47                         ` Jon Harrop
2008-03-28 23:24                           ` Oliver Bandel
2008-03-31  8:31                         ` Berke Durak
2008-03-29 14:03                       ` Peng Zang
2008-03-28 12:03                 ` Oliver Bandel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4a051d930803191044t1a1e9cb6h65ddbbda24cd7e1d@mail.gmail.com \
    --to=cconway@cs.nyu.edu \
    --cc=caml-list@yquem.inria.fr \
    --cc=daniel.buenzli@erratique.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).