Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Comparing Tagged Types

Tags:

ada

gnat

In Java, one would use the instanceof in order to check if an object is of the same type (or class-wide type) as another object. For instance, if we have the class Peach and an object peach, it would through the following:

if (peach instanceof Peach)
    System.out.println("peach is of type Peach!");

... execute the statement above into the terminal.

From what I remember, in Ada, there is something along the lines of is in, as in that some object is inside a certain class-wide set. Brilliantly enough, however, I cannot seem to find information on the subject for the purpose of this question. Last time I used the is in, I couldn't get it to work. As such, I decided to ask the question on here instead.

Any pointers as to how comparison of tagged types might be done in a similar manner to that of Java's instanceof would be very helpful!

like image 751
D. Ataro Avatar asked Dec 10 '22 08:12

D. Ataro


1 Answers

just in, not is in

if Foo in Peach'Class then
like image 112
egilhh Avatar answered Feb 09 '23 11:02

egilhh