Union tag comparison
[Thread Prev] | [Thread Next]
[Date Prev] | [Date Next]
- Subject: Union tag comparison
- From: Mural <mail@xxxxxxx>
- Reply-to: myrddin-dev@xxxxxxxxxxxxxx
- Date: Wed, 12 Feb 2020 10:10:54 +0800
- To: myrddin-dev@xxxxxxxxxxxxxx
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?
| Re: Union tag comparison | ori@xxxxxxxxxxxxxx |
- Next by Date: Re: Union tag comparison
- Next by thread: Re: Union tag comparison
- Index(es):