blah blah blah:
type EitherSide = enum
ok, err
type Either[L, R] = object
case kind: EitherSide
of ok:
mleft: L
else:
mright: R
proc `right=`*[L,R](this: var Either[L, R]; value: R): void =
this.kind = err
this.mright = value
proc `left=`*[L,R](this: var Either[L, R]; value: L): void =
this.kind = ok
this.mleft = value
proc right*[L,R](this: Either[L, R]): R =
this.mright
proc left*[L,R](this: Either[L, R]): L =
this.mleft
proc myfunc() : Either[int, string] =
result.right = "Not implemented yet!"
let x = myfunc()
echo x.right