[MLton] Re: Type of _address?

Stephen Weeks MLton@mlton.org
Thu, 21 Jul 2005 08:38:25 -0700


> +        | ADDRESS string COLON ty COMMA ty SEMICOLON
> +          (Exp.Prim {kind = PrimKind.Address {name = string},
> +                     ty = Type.makeRegion' (
> +                             Type.tuple (Vector.new2 (ty1, ty2)),
> +                             ty1left, ty2right)})
...
> +        | SYMBOL ASTERISK symattributes COLON ty COMMA ty SEMICOLON
> +          (Exp.Prim {kind = PrimKind.ISymbol {attributes = symattributes},
> +                     ty = Type.makeRegion' (
> +                             Type.tuple (Vector.new2 (ty1, ty2)),
> +                             ty1left, ty2right)})

Rather than encode the pair of types as a tuple, I think it would be
clearer to keep the two types separate.  I realize this is a slightly
bigger change.  But it doesn't seem too hard to fold the type (or
types) into the kind, and drop the {kind, ty} record, making Exp.Prim
be Exp.Prim of PrimKind.t.