From: Brian Rogoff <bpr@best.com>
To: caml-list@inria.fr
Subject: Re: Array interface question
Date: Thu, 28 Jan 1999 11:57:09 -0800 (PST) [thread overview]
Message-ID: <Pine.BSF.4.05.9901281120520.20851-100000@shell5.ba.best.com> (raw)
In-Reply-To: <199901242136.WAA13264@pauillac.inria.fr>
On Sun, 24 Jan 1999, Pierre Weis wrote:
> The Some (Some ...) problem could be solve if option where not only a
> datatype but ... an option of record field names (or even constructor
> names), analoguous to the mutable annotation for record fields. You
> could write
>
> type person = { option name : string; option age : int};;
>
> This way the None values can be introduced by the compiler when
> building a value of type person, for each optional field with no
> associated value. The Some constructors would be ommitted from the
> representation as desired. At pattern matching you may write None as a
> valid pattern for an optional field, and write the normal expected
> pattern otherwise (no need to write a Some constructor). In addition,
> you could set once an optional field with some value, the compiler
> checking that this field is indeed None before setting the new value.
This is an interesting idea, but I fear that for my particular problem
this is not helpful. For example, lets say I want to represent a Sequence
abstraction as an array of arrays, where the top level array grows by
doubling when an addition forces a resizing, and the data blocks are
of fixed size. Currently, I represent the indirection array as a
"'a array option Dynarray.t", and all of my access functions contain a
pattern match to extract the data array. Its this needless wrapping and
unwrapping (forced since I don't want to have "fill" elements in the
interface) of the array elements that I don't like, though I don't know
of any better option.
-- Brian (yes, the pun is intentional)
next prev parent reply other threads:[~1999-01-28 20:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-01-22 19:10 Brian Rogoff
1999-01-22 19:21 ` Pierre Weis
1999-01-22 20:05 ` Brian Rogoff
1999-01-23 10:47 ` Anton Moscal
1999-01-23 10:57 ` David Monniaux
1999-01-24 15:44 ` Jerome Vouillon
1999-01-24 21:36 ` Pierre Weis
1999-01-28 19:57 ` Brian Rogoff [this message]
1999-01-23 14:00 ` Size of arrays Juan Jose Garcia Ripoll
1999-01-24 22:31 ` 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=Pine.BSF.4.05.9901281120520.20851-100000@shell5.ba.best.com \
--to=bpr@best.com \
--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