Hi,

Am Dienstag, den 08.09.2015, 08:53 +0100 schrieb Simon Marlow:
> On 07/09/2015 15:35, Simon Peyton Jones wrote:
> > Good start.
> > 
> > I have updated the page to separate the source-language design (what the
> > programmer sees) from the implementation.
> > 
> > And I have included boxed sums as well – it would be deeply strange not
> > to do so.
> 
> How did you envisage implementing anonymous boxed sums?  What is their 
> heap representation?
> 
> One option is to use some kind of generic object with a dynamic number 
> of pointers and non-pointers, and one field for the tag. 

Why a dynamic number of pointers? All constructors of an anonymous sum
type contain precisely one pointer (just like Left and Right do), as
they are normal boxed, polymorphic data types.

Also the constructors
  (0 of 1 | _ )
  (0 of 2 | _ )
  (0 of 3 | _ )
(using Lennart’s syntax here) can all use the same info-table: At
runtime, we only care about the tag, not the arity of the sum type.

So just like for products, we could statically generate info tables for
the constructors
  (0 of ? | _ )
  (1 of ? | _ )
   ⁞
  (63 of ? | _ )
and simply do not support more than these.

(Or, if we really want to support these, start to nest them. 63² will
already go a long way... :-))

Greetings,
Joachim

-- 
Joachim “nomeata” Breitner
  m...@joachim-breitner.de • http://www.joachim-breitner.de/
  Jabber: nome...@joachim-breitner.de  • GPG-Key: 0xF0FBF51F
  Debian Developer: nome...@debian.org

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
ghc-devs mailing list
ghc-devs@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

Reply via email to