Enumerative datatype implementation

Hi all,

How are enumerative datatypes represented at runtime? My guess is
word-sized integral types, but I’d like to know for sure.

~Shea

Your guess is correct :slight_smile:

You will see if you paste the following code into:
http://www.ats-lang.org/COMPILED/doc/PROJECT/LARGE/TUTORATS/services/patsopt-atscc2js-trial/inputform.html

//
#include
“share/atspre_define.hats”
//
(* ****** ****** )
//
#define ATS_MAINATSFLAG 1
#define ATS_DYNLOADNAME “my_dynload”
//
#include
“{$LIBATSCC2JS}/staloadall.hats”
//
(
****** ****** *)

datatype abc = A | B | C

%{^
var A;
var B;
var C;
%}
extvar “A” = A
extvar “B” = B
extvar “C” = C

%{$
my_dynload(); alert("A = " + A); alert("B = " + B); alert("C = " + C)
%} // …On Wednesday, September 10, 2014 2:32:24 PM UTC-4, Shea Levy wrote:

Hi all,

How are enumerative datatypes represented at runtime? My guess is
word-sized integral types, but I’d like to know for sure.

~Shea