caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Patrick M Doane <patrick@watson.org>
To: Chris Hecker <checker@d6.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] variant with tuple arg in pattern match?
Date: Wed, 4 Apr 2001 15:49:35 -0400 (EDT)	[thread overview]
Message-ID: <Pine.BSF.3.96.1010404153920.5769B-100000@fledge.watson.org> (raw)
In-Reply-To: <4.3.2.7.2.20010404123148.03366c90@shell16.ba.best.com>

Hi Chris,

This only becomes an issue when the data being associated with a
constructor would need to be boxed.  Since an int doesn't require any
boxing, the type 'foo = Foo of int' will work exactly as expected.

Boxing/unboxing optimizations can be very subtle. The most important
example I can think of is computation with complex numbers.  Is it better
for the the representation to be as a pair of floats in one structure or
as two separate floats?  Different parts of a program may do better with
one representation instead of the other.

As far as I understand, the compiler could choose a representation for
variants and insert the necessary transformation code to hide the issue
from the programmer entirely.  I haven't thought about the issue much so 
there could be a real problem that I'm not seeing. From what I remember,
SML does not make this kind of syntactic distinction.

Patrick

On Wed, 4 Apr 2001, Chris Hecker wrote:

> 
> >I would certainly like it if Caml could:
> >  1) Treat this entirely as an optimization issue and not make a syntactic
> >distinction.
> 
> I agree.  Is there a reason why it's done this way?  I guess you need to
> be able to bind another name to the tuple independently, and for that to
> work you need it to be another block on the heap.  Maybe it's not
> possible in general to do the right thing. 
> 
> But wait, why isn't this a problem even with normal non-tupled values?
> 
> In other worlds, how does type foo = Foo of int work when I take a
> reference to the int?  It has to know I'm refering to the int to GC
> correctly.  Why is the tuple version any different? 
> 
> I'm confused.
> 
> Chris
> 
> 

-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr


  parent reply	other threads:[~2001-04-04 19:49 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-04 11:04 Chris Hecker
2001-04-04 18:47 ` Alain Frisch
2001-04-04 19:18 ` Patrick M Doane
2001-04-04 19:36   ` Chris Hecker
2001-04-04 19:49     ` Daniel de Rauglaudre
2001-04-05  8:19       ` Christian RINDERKNECHT
2001-04-04 19:49     ` Patrick M Doane [this message]
2001-04-06 13:52   ` Xavier Leroy
2001-04-07  1:42     ` Patrick M Doane
2001-04-07  6:44       ` Daniel de Rauglaudre
2001-04-07  7:42     ` Fergus Henderson
2001-04-08 19:45       ` Pierre Weis
2001-04-08 20:37         ` Charles Martin
2001-04-08 23:57         ` Brian Rogoff
2001-04-09  0:22           ` Alain Frisch
2001-04-09 16:07             ` Pierre Weis
2001-04-10  8:23               ` Michel Mauny
2001-04-10  9:14                 ` Xavier Leroy
2001-04-10 10:09                   ` Michel Mauny
2001-04-10 10:44                 ` reig
2001-04-10 11:32                   ` Michel Mauny
2001-04-10 11:47                     ` reig
2001-04-10 12:10                       ` reig
2001-04-10 12:35                         ` Michel Mauny
2001-04-10 12:49                         ` Marcin 'Qrczak' Kowalczyk
2001-04-09  6:23           ` Mattias Waldau
2001-04-09  7:34             ` Daniel de Rauglaudre
2001-04-09 15:57           ` Pierre Weis
2001-04-10  9:07             ` Sven LUTHER
2001-04-09  8:20         ` Christian RINDERKNECHT
2001-04-10  2:54         ` Patrick M Doane
2001-04-10 19:04           ` John Max Skaller
2001-04-08  0:22 jgm
2001-04-10 12:17 Dave Berry
2001-04-10 13:12 ` Marcin 'Qrczak' Kowalczyk
2001-04-10 21:26   ` Bruce Hoult
2001-04-10 22:34     ` John Prevost
2001-04-10 13:51 ` Frank Atanassow
2001-04-10 17:25 Dave Berry
2001-04-10 23:16 ` Marcin 'Qrczak' Kowalczyk
2001-04-10 17:33 Dave Berry
2001-04-10 22:34 ` John Prevost

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.3.96.1010404153920.5769B-100000@fledge.watson.org \
    --to=patrick@watson.org \
    --cc=caml-list@inria.fr \
    --cc=checker@d6.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;
as well as URLs for NNTP newsgroup(s).