* Boxing wrt. unary constructors
@ 1998-10-14 9:43 Don Syme
1998-10-15 17:25 ` Xavier Leroy
0 siblings, 1 reply; 2+ messages in thread
From: Don Syme @ 1998-10-14 9:43 UTC (permalink / raw)
To: caml-list
This is probably a FAQ, but if I have a type
type abc = ABC of int
then does Ocaml 2.00 use a boxed or unboxed repr. of values of this
type?
Thanks,
Don
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Boxing wrt. unary constructors
1998-10-14 9:43 Boxing wrt. unary constructors Don Syme
@ 1998-10-15 17:25 ` Xavier Leroy
0 siblings, 0 replies; 2+ messages in thread
From: Xavier Leroy @ 1998-10-15 17:25 UTC (permalink / raw)
To: Don Syme, caml-list
> This is probably a FAQ, but if I have a type
> type abc = ABC of int
> then does Ocaml 2.00 use a boxed or unboxed repr. of values of this
> type?
Boxed. While it would not be hard to make a special case for
one-constructor datatypes, this is not currently done in the OCaml
compiler. However, you can use type abstraction to obtain much of the
same effects while keeping an unboxed representation:
(struct type abc = int let abc x = x let proj_abs x = x end :
sig type abc val abc: int->abc val proj_abc: abc->int end)
Regards,
- Xavier Leroy
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1998-10-16 11:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-10-14 9:43 Boxing wrt. unary constructors Don Syme
1998-10-15 17:25 ` Xavier Leroy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox