[Implemented] new constant : #String = 4

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

helpy:

viewtopic.php?t=10835&highlight=typeof
viewtopic.php?t=9691&highlight=typeof

i needed it for some 'structure' stuff where my routine would have to deduct what type a field of a structure was, somewhat superfluous but sometimes handy...

however, when using dynamic parameters (or variants or overloading or what the heck) in procedure calls it's an essential...
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
User avatar
helpy
Enthusiast
Enthusiast
Posts: 552
Joined: Sat Jun 28, 2003 12:01 am

Post by helpy »

Dare2 wrote:Imagine if we could pass unknown (to the function) arithmetic types as arguments, have the function do a typeOf() and then take appropriate action.

Then we could have doSomething(v) instead of multiple functions like doSomethingLong(v.l), doSomethingFloat(v.f), etc.
This means, that the passing of arguments hast to be changed! Otherwise a typeof() would not make any sense.

At this time in PureBasic each variable has a fixed datatype! ... and it is not possible to change the type of a variable during runtime.

So it makes only sense to "wisch a typeof()" if at the same time you wish the "change of passing function arguments" or "a new datatype like VARIANT".

I am not sure, if I would be happy with VARIANT data type, because it needs much overhead managing the memory and data type conflicts. This would be the source of many ... many ... many new bugs in PureBasic.

cu, helpy
Post Reply