From: Anton Moscal <msk@post.tepkom.ru>
To: Jerry Jackson <jrj@channelpoint.com>
Cc: "'caml-list@inria.fr'" <caml-list@inria.fr>
Subject: Re: null values and sentinels
Date: Mon, 18 Jan 1999 13:05:42 +0300 (MSK) [thread overview]
Message-ID: <Pine.LNX.4.03.9901181301500.25253-100000@post.tepkom.ru> (raw)
In-Reply-To: <8A24EC12044FD21195E200600895E0B34BFBC2@goat.channelpoint.com>
On Tue, 12 Jan 1999, Jerry Jackson wrote:
> Hello,
>
> I'd like to know what the recommended solution to the following
> situation is...
>
> I'd like to create a type like:
>
> # type foo = {xxx: int; mutable yyy: foo};;
>
> so that I can add nodes by mutating the "yyy" slots. Unfortunately,
> it seems that I must create a sentinel value of type "foo" to stand
> for a null pointer. This works but I'd like to be able to use pattern
> matching on the value of yyy so as to get compile-time warnings if I
> forget to check for null.
The only known to me solution is the following:
declare
let rec foo_nil = {xxx=1; yyy = foo_nil};
and then use foo_nil as Nil constant. The main problem is the
following: foo_nil can't be used in the matching.
Anton E.Moscal
prev parent reply other threads:[~1999-01-18 11:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-01-12 15:50 Jerry Jackson
1999-01-17 11:13 ` Xavier Leroy
1999-01-18 10:05 ` Anton Moscal [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=Pine.LNX.4.03.9901181301500.25253-100000@post.tepkom.ru \
--to=msk@post.tepkom.ru \
--cc=caml-list@inria.fr \
--cc=jrj@channelpoint.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