What type of object is this?

BlitzMax Forums/BlitzMax Beginners Area/What type of object is this?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

1. yep
2. yep
3. this is indeed no a great solution to say the least.

the only trivial numeric check is the one for double due to sizeof differences with int / float.
Here you're again testing for a type that is very well known at compile time (the sizeof an integer or a float, or double won't magically change during runtime, because the type itself certainly won't change), in short it has no use.
framework brl.basic
Import brl.standardio

Local f% = 123.456
Local d! = 123.456

Local v! ' or v%

v = f
Print SizeOf(v)

v = d
Print SizeOf(v)
It's clear that sizeof v will always be the same no matter the type of the value that was assigned to it. For even more fun use a string var (v$).

I've been thinking about I could make Numerics as real types as it can sometimes be quite frustrating when you are normally used to Eiffel which only has types and full OO no procedural anymore)
It's indeed easy to make some TInt, TDouble etc wrapper type, and will allow to put numerics in lists TList by example. This is exactly what Java does, even if it isn't perfect.
At least if your var is reference to an object (excepting string) you know an integer or a float can't be cast to an object so you would have no problem : handling the case where the var is a numeric would only mean handling these wrappers.