From: Sven Luther <luther@dpt-info.u-strasbg.fr>
To: sergey dyshel <sdieselil@yahoo.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] How can I simulate dynamic types in OCaml?
Date: Sat, 5 Apr 2003 22:58:01 +0200 [thread overview]
Message-ID: <20030405205801.GA17522@iliana> (raw)
In-Reply-To: <20030404115842.87369.qmail@web41213.mail.yahoo.com>
On Fri, Apr 04, 2003 at 03:58:42AM -0800, sergey dyshel wrote:
> Hi
>
> I like static type-checking in OCaml but sometimes I
> need to implement some dynamic stuff (like a list of
> values of different types). Is there a way to
> do it in OCaml or at least simulate this?
Use a list of variants ?
type element = A of a | B of b | C of c | D of d | ...
type liste = element list
You have to check the appropriate variant each time (or most time) you
use it, but after all, you wanted dynamic type checking.
Friendly,
Sven Luther
-------------------
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
prev parent reply other threads:[~2003-04-05 20:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-04 11:58 sergey dyshel
2003-04-05 20:55 ` Michael Tucker
2003-04-05 20:58 ` Sven Luther [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=20030405205801.GA17522@iliana \
--to=luther@dpt-info.u-strasbg.fr \
--cc=caml-list@inria.fr \
--cc=sdieselil@yahoo.com \
/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