Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Tiphaine Turpin <Tiphaine.Turpin@irisa.fr>
To: Goswin von Brederlow <goswin-v-b@web.de>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Problem correlating input and output type
Date: Mon, 01 Feb 2010 23:12:12 +0100	[thread overview]
Message-ID: <4B6751BC.9010402@irisa.fr> (raw)
In-Reply-To: <87mxzt54lc.fsf@frosties.localdomain>

Goswin von Brederlow a écrit :
> Tiphaine Turpin <Tiphaine.Turpin@irisa.fr> writes:
>
>   
>> Goswin von Brederlow a écrit :
>>     
>>> [...]
>>>
>>> Can anyone think of a way to express this so that the type system keeps
>>> track of which callbacks are already connected?
>>>   
>> Runtime checking would be much easier (but still a bit hackish).
>>     
>
> But runtime checks will only show the error when the GUI object is
> instantiated. Some obscure dialog might not pop up in month.
[...]
> But how do you translate that into ocaml objects?
>
>   
I see two requirements in your problem that are difficult to combine:
- static checking by an "ordinary" type system
- dynamic connection of objects.

First, I believe that it prevents anything imperative (because such
typing ignores the execution flow). A functional approach may succeed in
some sense, but I don't think that it would be practical. As for the
combination with objects, In my (humble) experience with objects in
Ocaml, I found that typing even reasonably simple designs is not a
trivial task. So, combining that with the earlier hack would quickly
become a nightmare.

My personal opinion would be to drop the second condition, and make the
connection of your objects static. I would try to define the objects as
functors, with one module parameter per connection, and connect all that
using (possibly recursive) module definitions.

I'm curious to know what solutions object-oriented people could propose,
in particular with dependency injection.

Tiphaine


      reply	other threads:[~2010-02-01 22:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-31 18:01 Goswin von Brederlow
2010-01-31 19:28 ` [Caml-list] " Tiphaine Turpin
2010-02-01 15:59   ` Goswin von Brederlow
2010-02-01 22:12     ` Tiphaine Turpin [this message]

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=4B6751BC.9010402@irisa.fr \
    --to=tiphaine.turpin@irisa.fr \
    --cc=caml-list@yquem.inria.fr \
    --cc=goswin-v-b@web.de \
    /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