Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Tiphaine Turpin <Tiphaine.Turpin@irisa.fr>
To: Keiko Nakata <keiko@kurims.kyoto-u.ac.jp>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] OO programming
Date: Mon, 03 Mar 2008 20:25:06 +0100	[thread overview]
Message-ID: <47CC5092.1050100@irisa.fr> (raw)
In-Reply-To: <20080304.001809.125117537.keiko@kurims.kyoto-u.ac.jp>

Keiko Nakata a écrit :
>>> As I see Jacques's code, he gradually extends the module type S 
>>> to S' and S''. Type declarations in module types and type definitions
>>> in structures involving types event, observer and subject are duplicated
>>> everywhere with slight modifications. 
>>> Why can we not extend the previously defined module type 
>>> in a less verbose way?
>>>   
>>>       
>> I agree. Maybe the idea of using parametric class type definitions (in 
>> WRichT) and defining unparameterized types afterwards (in S'') could be 
>> helpfull, as such definitions can be extended with the "inherit 
>> <class-type>" construct. Otherwise you would need to keep syntaxically 
>> the successive declarations with camlp4 for future use, which is not 
>> very handy. 
>>     
>
> Parametric class type definitions should be helpful.
> We might need as many type parameters as (class) type definitions involved;
> do you think this can be problematic, 
> particularly in respect of type error messages?
>   
Only experiments can tell us. But I suspect that using a systematic 
scheme for defining classes and relating them to each other should avoid 
users to make too many errors that come from a misunderstanding of the 
type system ('self escaping its scoope, or unified wit a closed type, 
etc.), thus allowing "advanced" use of caml objects by non type systems 
experts (including me).
> Hopefully we want to start with S and 
> derive its refinements by extending S bit by bit. 
> But here is one problem: module type declarations (e.g. S) and 
> structures (e.g. WindowA) are completely different entities;
> it can be handy in practice if we can include S in WihdowA 
> and refine the included types by giving concrete representations
> to abstract types (e.g. event).
>
> Well, I know that module types and structures are 
> indeed completely different 
> from the theoretical point of view....
>   
In this case where they are only made of (the same) types with a class 
type on one side and a private row type on the other side, this 
theoretical difference is far from obvious in practise, and this is one 
of the reasons why such code is so hard to read (as the same thing seem 
to be repeated twice). This would be nice if you could write your types 
once (possibly in a very small subset of the type language) and have the 
module and the module type be generated from the same code.
> Here is another thing that may be worth attention.
> The types observer and subject in WRichT are not recursive, 
> but we take their fix-point in S''. 
> Unfortunately we cannot do this kind of refinement 
> via the "with" construct. 
>
> Anyway, I think we are almost exactly following OO-programming style
> in a more explicit thus more verbose way. 
> So I conjecture that if we come up with good syntactic sugar, 
> we can be as concise as OOP; as you suggest it may well be 
> a good idea to expand the sugar into parametric class definitions, 
> possibly combined with functors and private row types to increase modularity. 
>   
I plan to do some reasonable scale "OOcaml" coding (in my spare time) 
for some project. I will first see if I can use some systematic scheme 
successfully before I try anything with camlp4. That said, some of us 
tend to think of everything only from within ocaml, and I know that some 
day I should give a try to other systems, like Scala and its "traits".

Tiphaine Turpin

> Best, 
> Keiko
>
> _______________________________________________
> 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-03 19:29 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-21  9:31 Tiphaine Turpin
2008-02-21  9:42 ` [Caml-list] " Erik de Castro Lopo
2008-02-21 13:38 ` Remi Vanicat
2008-02-24 16:33 ` [Caml-list] " Dirk Thierbach
2008-02-25  9:23   ` Tiphaine.Turpin
2008-02-25 15:48     ` Edgar Friendly
2008-02-25 16:02       ` Berke Durak
2008-02-25 20:12         ` Dirk Thierbach
2008-02-25 20:51           ` Tiphaine.Turpin
2008-02-25 23:03             ` Dirk Thierbach
2008-02-25 20:10     ` Dirk Thierbach
2008-02-25 21:49       ` Tiphaine.Turpin
2008-02-25 23:07         ` Dirk Thierbach
2008-02-29 14:22       ` Tiphaine.Turpin
2008-02-26  6:17 ` Jacques Garrigue
2008-02-26  9:36   ` Julien Signoles
2008-02-27  0:25   ` Tiphaine.Turpin
2008-02-27  1:37     ` Jacques Garrigue
2008-02-28  8:34       ` Keiko Nakata
2008-02-28 13:30         ` Andrej Bauer
2008-02-28 15:18           ` Keiko Nakata
2008-02-28 16:02           ` Edgar Friendly
2008-02-29 14:35         ` Tiphaine.Turpin
2008-02-29 15:58           ` Keiko Nakata
2008-03-03  9:40             ` Tiphaine.Turpin
2008-03-03 10:20               ` Jacques Garrigue
2008-03-03 10:30                 ` Tiphaine.Turpin
2008-03-03 15:18               ` Keiko Nakata
2008-03-03 19:25                 ` Tiphaine Turpin [this message]
2008-03-04 14:00                   ` Keiko Nakata
2008-02-27  7:40     ` Dirk Thierbach
2008-02-27 14:04       ` Tiphaine.Turpin

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=47CC5092.1050100@irisa.fr \
    --to=tiphaine.turpin@irisa.fr \
    --cc=caml-list@inria.fr \
    --cc=keiko@kurims.kyoto-u.ac.jp \
    /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