In Java you can easily check your types with "instanceof" - is there an equivalent or other way to proof your types?
You can get the type of an object using obj.typeof. Then you can use type.fits to see if it is instance of another type
The is operator: typeChecking.
is
And it's better to ask questions on StackOverflow.
Good call!
A response from a recent instanceof forum post sums up what has been said already:
Try is and isnot - see Type Checking:
isnot
69 is Num // --> true 69 isnot Num // --> false (69 as Num) is Float // --> false
There is also Type.fits() - see fits:
Type.fits()
69.typeof.fits(Num#) // --> true 69.typeof.fits(List#) // --> false
Login or Signup to reply.
isomorph Mon 21 Aug 2017
In Java you can easily check your types with "instanceof" - is there an equivalent or other way to proof your types?
matthew Mon 21 Aug 2017
You can get the type of an object using obj.typeof. Then you can use type.fits to see if it is instance of another type
go4 Mon 21 Aug 2017
The
is
operator: typeChecking.And it's better to ask questions on StackOverflow.
SlimerDude Tue 22 Aug 2017
Good call!
A response from a recent instanceof forum post sums up what has been said already:
Try
is
andisnot
- see Type Checking:There is also
Type.fits()
- see fits: