From: Vyskocil Vladimir <vyskocil@math.unice.fr>
To: Caml list <caml-list@inria.fr>
Subject: Constante NIL
Date: Mon, 31 May 1999 16:20:40 +0200 [thread overview]
Message-ID: <37529AB8.B306AD5F@math.unice.fr> (raw)
Bonjour,
N'est t'il pas concevable de rajouter a Objectif Caml une constante
NIL, UNDEF ou je sais pas trop comment la nommer dont la valeur serait
'_a. Ceci permettrait d'initialiser "par defaut", par exemples,
les variables d'instances d'une classe lorsque l'on ne possede aucune
valeur par defaut du bon type. Je sais qu'il y'a toujours la possibilite
d'utiliser le type 'a option mais ca devient lourd a gerer...
Comme pour le type "special" '_a, la variable d'instance prendrait le
bon type des qu'il est connu.
J'utilise actuellement CamlTk encapsulé par des classes et cette
situation
se presente frequement, par exemple (en simpifié) :
class toplevel parent =
object
end
;;
class bouton parent =
object
end
;;
class boite parent =
let win = new toplevel parent in
object (self)
inherit toplevel parent
method get_win = win
end
;;
class ma_boite parent =
object (self)
inherit boite parent as super
val mutable bt = ??? (* <- que mettre ici ? *)
initializer
(* ici l'objet est initialise donc on peut recuperer le parent *)
bt = new bouton super#get_win
end
;;
--
Vyskocil Vladimir
vyskocil@math.unice.fr
http://pcmath65.unice.fr/~vyskocil
http://www.inria.fr/safir/WHOSWHO/Vladimir.html
next reply other threads:[~1999-06-01 15:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-05-31 14:20 Vyskocil Vladimir [this message]
1999-06-01 16:16 ` Francois Rouaix
1999-06-02 7:27 ` Jean-Francois Monin
1999-06-02 19:02 ` Xavier Leroy
1999-06-14 20:48 ` 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=37529AB8.B306AD5F@math.unice.fr \
--to=vyskocil@math.unice.fr \
--cc=caml-list@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