Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: boos@gr6.u-strasbg.fr (Christian Boos)
To: caml-list@margaux.inria.fr
Subject: [Q]: Mutable variant types in Caml Light 0.7
Date: Thu, 19 Oct 95 11:31:13 +0100	[thread overview]
Message-ID: <9510191031.AA19481@gr6> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1517 bytes --]



Bonjour,

J'aimerais avoir un avis sur le problème suivant.

Pour définir des types "union", il y a deux approches possibles :

a)	type t = A of int * float * string

ou bien

b)	type t = A of record
	and record = { a:int; b:float; c:string; }


Je crois être en présence du dilemme suivant : 
 - sur le plan efficacité, a) > b) :
    a) 'allocation à plat' -> économe en espace
    b) indirection vers l'enregistrement -> lent

 - sur le plan souplesse d'utilisation, b) > a) :
    a) une indication 'mutable' s'applique obligatoirement à
       l'ensemble des champs, qui de ce fait sont alloués en tant que
       n-uplets. On perd donc les avantages mentionnés précedemment,
       sans avoir de réel confort d'utilisation.
    b) bien sûr, il est ici possible de déclarer chaque champ
       'mutable'.

Si ce raisonnement est correct, une amélioration pourrait alors être
effectuée, permettant de cumuler efficacité et souplesse :
  - soit une grosse refonte de la syntaxe des types, pour avoir des
déclarations à la SML (mais plus expressives, en raison du 'mutable') :
	
	type t = A of { a:int; mutable b:float; c:string; }

  - soit en faisant une modification sur la syntaxe de l'extension 3.6
permettant d'avoir des types "union" mutables :

	type t = A of int * (mutable float) * string


... par ailleurs, qu'en est-il de ce problème en CSL ?


Merci pour vos conseils !


------------------------------------------------------------------
Christian Boos
Doctorant en Informatique
ULP - Strasbourg.




             reply	other threads:[~1995-10-19 13:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-10-19 10:31 Christian Boos [this message]
1995-10-19 14:53 ` Pierre Weis
1995-10-19 15:16 ` Andrew Conway
1995-10-20 18:55   ` Pierre Weis

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=9510191031.AA19481@gr6 \
    --to=boos@gr6.u-strasbg.fr \
    --cc=caml-list@margaux.inria.fr \
    /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