Re: Union tag comparison
[Thread Prev] | [Thread Next]
- Subject: Re: Union tag comparison
- From: Mural <mail@xxxxxxx>
- Reply-to: myrddin-dev@xxxxxxxxxxxxxx
- Date: Wed, 12 Feb 2020 10:41:50 +0800
- To: "Ori Bernstein" <ori@xxxxxxxxxxxxxx>, myrddin-dev@xxxxxxxxxxxxxx
On Wed, Feb 12, 2020, at 10:34 AM, ori@xxxxxxxxxxxxxx wrote: > > Hello, > > > > Say, I have a > > type expr = union > > `Oadd(expr#, expr#) > > `Oneg(expr#) > > ;; > > > > I want to compare two expr values to determine whether they are of the same Op. > > As I know, I can define a function that maps each variant into a distinct integer or string. > > But It'd be nice if it can be as simple as how C does: 'a.Op == b.Op'. > > I am thinking about a builtin function that retrieves the internal integer value of the union tag. > > Am I missing something? > > Seems sane-enough. I'd prefer if instead of a function, it was a magic > '.tag' member, > kind of like '.len' on arrays. > Noted. Thanks.
Re: Union tag comparison | ori@xxxxxxxxxxxxxx |
- Prev by Date: Re: Union tag comparison
- Next by Date: Default type and named type?
- Previous by thread: Re: Union tag comparison
- Next by thread: Default type and named type?
- Index(es):