Krux02: Thanks a lot.
cdome: I see. So you say types in the return value don't bind type variables.
[sorry, added "n't" later]
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
I cleaned up the code and added more commments. It should be much easier now to
uderstand what/why the code is doing after reading my paper.
Here is the gist location of the source code for this version.
As many other people, I've tried to write an `Either` type for my own purposes
(peeking into others' solutions). Here is a piece of code that illustrates the
problem I encountered:
type EitherSide = enum
ok, err
type Either[L, R] = ref object
case kind: EitherSide
* A few Chat systems. One of them is in use every day. So its kinda like
Production.
* Since NiGui -> guis; one is in production
* p2p Toys
* bots
* everything else
Nim has replaced every language (except javascript maybe) that im currently
writeing. I dont want to code in other