caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Re: [Caml-list] Peut on unifier foncteurs et objets ?
  2004-08-06 10:14 [Caml-list] Peut on unifier foncteurs et objets ? Diego Olivier Fernandez Pons
@ 2004-08-05 23:48 ` Christophe Raffalli
  2004-08-06 15:29 ` John Prevost
  1 sibling, 0 replies; 4+ messages in thread
From: Christophe Raffalli @ 2004-08-05 23:48 UTC (permalink / raw)
  To: Diego Olivier Fernandez Pons; +Cc: caml-list


Pour faire (vraiment trop) simple, OUI:

Si on oublie un peu le typage (pas pour longtemps)

- Un module c'est un record + des existentiels pour les types abstraits.
- Il faut aussi un epsilon de Hilbert pour interpréter le M.t quand t 
est un type et pour pouvoir ainsi écrire des contraintes de types.
- Un foncteurs n'est alors qu'une fonction + des contraintes de types.
- Un object n'est qu'un record récursifs (à cause du self) (il faut 
aussi un peu de sucre syntaxique pour la surcharge et l'héritage et 
quelques décisions quant à leur sémantique).

Le pb c'est le typage, mais si l'on abandonne la décidabilité, il suffit 
d'une extension de système F: système ST (voir mes deux papiers sur ma 
page et la thèse a venir (6 mois ?) de Frédérique Ruyer qui sera 
précisément sur ce sujet).

En plus dans le système que l'on propose et que l'on va implanter, on 
pourra aussi spécifier les programmes (de toutes façons, pour écrire 
toutes les contraintes de types dont on a besoin, il faut  presque tout 
système ST, et si on prends tout, on peut spécifier et prouver).


-- 
Christophe Raffalli
Université de Savoie
Batiment Le Chablais, bureau 21
73376 Le Bourget-du-Lac Cedex

tél: (33) 4 79 75 81 03
fax: (33) 4 79 75 87 42
mail: Christophe.Raffalli@univ-savoie.fr
www: http://www.lama.univ-savoie.fr/~RAFFALLI
---------------------------------------------
IMPORTANT: this mail is signed using PGP/MIME
At least Enigmail/Mozilla, mutt or evolution
can check this signature
---------------------------------------------

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Caml-list] Peut on unifier foncteurs et objets ?
@ 2004-08-06 10:14 Diego Olivier Fernandez Pons
  2004-08-05 23:48 ` Christophe Raffalli
  2004-08-06 15:29 ` John Prevost
  0 siblings, 2 replies; 4+ messages in thread
From: Diego Olivier Fernandez Pons @ 2004-08-06 10:14 UTC (permalink / raw)
  To: caml-list

    Bonjour,

Il y a régulièrement sur la liste Caml des discussions au sujet des
mérites respectifs des foncteurs par rapport aux objets et des
possibilités d'extensions (méthodes polymorphes, modules de première
classe, etc.)

La redondance entre le système de modules/foncteurs et celui des
objets n'est pas à mon avis tant le problème. Après tout le
programmeur Caml doit déjà se décider entre :
- structures de données éphémères ou persistantes
- boucles ou récursion
- f = fun x y -> ou f x = function ... ->
- if ou match ... with
- fonctions récursives à plusieurs arguments ou application partielle
(ex. map)
- types somme ou variantes polymorphes
- types somme ou enregistrements
- etc.

Ce qui est nettement plus ennuyeux quand on passe du premier jet de
code (sous forme de module) à un foncteur, puis on change pour un
objet (pensant utile de changer son comportement à l'exécution), puis
on revient au foncteur (car non, c'est mieux d'abstraire), etc. c'est
qu'on a _vraiment_ l'impression de ne faire que du copier/coller.

Mes foncteurs c'est mon module initial dans lequel j'ai remplacé
'compare' par 'M.compare', mes objets c'est mon module initial auquel
j'ai ajouté une capsule ne contenant que des 'method f = {< obj = f
obj >}'

Je ne connais certainement pas grand chose aux questions de typage, de
compilation ou d'abstraction mais je me demande bien pourquoi Caml ne
peut il pas faire le gros du copier/coller à ma place en offrant une
notion plus ou moins unifiée (avec un simple mot cle pour changer le
comportement désiré ou quelque chose du genre).


        Diego Olivier


-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] Peut on unifier foncteurs et objets ?
  2004-08-06 10:14 [Caml-list] Peut on unifier foncteurs et objets ? Diego Olivier Fernandez Pons
  2004-08-05 23:48 ` Christophe Raffalli
@ 2004-08-06 15:29 ` John Prevost
  2004-08-06 15:43   ` Diego Olivier Fernandez Pons
  1 sibling, 1 reply; 4+ messages in thread
From: John Prevost @ 2004-08-06 15:29 UTC (permalink / raw)
  To: caml-list

Please forgive me if I make some mistakes in interpreting your
message.  My French is not good at all.

I believe the message was talking about the merging of
modules/functors and objects, and how there is a lot of redundancy in
O'Caml already, and that's not necessarily a bad thing.

My feeling about modules and objects is not that they should be in any
way unified--they do indeed serve different roles.  What I *would*
like to see is a bit better support when the two things are used
together.  The recent thread about how to write the functor such that
it takes in a module with a class in it and uses that class is a good
example of a rough spot--you can manipulate the type part of a class
like it is a type.  You can wrap the "new blah" construct in an actual
function.  But you cannot truly express in a functor that "module F (A
: MT_Having_Class_Cl) : MT_Having_Other_Class_Cl with class cl = A.cl"

It is this sort of difficulty that can scare a user of objects away
from using functors, even when functors do suit their needs admirably.
 I'd also suggest that some advanced examples of modules and functors
sans objects might be nice to have in the manual--but that's really
something that can be done by the community (and outside the manual.)

John.

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] Peut on unifier foncteurs et objets ?
  2004-08-06 15:29 ` John Prevost
@ 2004-08-06 15:43   ` Diego Olivier Fernandez Pons
  0 siblings, 0 replies; 4+ messages in thread
From: Diego Olivier Fernandez Pons @ 2004-08-06 15:43 UTC (permalink / raw)
  To: John Prevost; +Cc: caml-list

    Bonjour,

> What I *would* like to see is a bit better support when the two
> things are used together.

Yes, that was the point. The 'unification' question was mostly pure
rhethoric. My actual problem is that I have many parallel
functor/object in my code because I some times need the first, some
times the later - and I never know from the beginning which one I
finally be using.

> It is this sort of difficulty that can scare a user of objects away
> from using functors, even when functors do suit their needs
> admirably.

I am usually scared of using _objects_ even if _objects_ do suit my
needs admirably.


         Diego Olivier

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-08-06 15:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-06 10:14 [Caml-list] Peut on unifier foncteurs et objets ? Diego Olivier Fernandez Pons
2004-08-05 23:48 ` Christophe Raffalli
2004-08-06 15:29 ` John Prevost
2004-08-06 15:43   ` Diego Olivier Fernandez Pons

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).