Hi Hongwei,
On Sun, Feb 22, 2015 at 11:54 PM, gmhwxi <
gmh...@gmail.com> wrote:
> datavtype
> either_vt
> (
> a1:vt@ype+
> , a2:vt@ype+
> , bool (*left/right:true/false*)
> ) =
> | inj_left(a1, a2, true) of a1
> | inj_right(a1, a2, false) of a2
>
> vtypedef
> Either_vt(a1:vt@ype, a2:vt@ype) = [b:bool] either_vt(a1, a2, b)
Thank's. It's useful for me.
Because sometimes I have wanted to return an errno or a result.
However,,,
> Surprisingly, the need for either_vt is very rare in practice. So it is not
> included in ATS at this moment.
I think I understand your option_v is better than the Either_vt.
It doesn't touch the malloc heap.
Thank's,