Passing 'type' as a parameter.

I have a method that reads raw data files that contain either 16 bit unsigned integers or 32 bit singles.
(These end up in a memory block)

I want to pass the type of data to a method of my class. but how do you pass UInt16 or Single as parameter?

I could define enumerated data types for each type that Memory block is aware of, but that seems somehow redundant.

Is there perhaps a way using the variant type?

create a series of overload methods?

Pass Introspection TypeInfo? (Through the Xojo framework.)

Thats how I created the Type Dictionary on my web site http://great-white-software.com/gws-rb-samples/TypedDict.zip
It gives you a dictionary that is type enforced for keys & values

Curious, why do you recommend the “new” classes over the classic ones?

Unless there has been some change, you can’t get the TypeInfo on an intrinsic type with Classic.

Dont use classic :stuck_out_tongue:
There are some things the new framework does better - this is one

They really need to step up the pace to add whatever is better in New to classic. Since now we have even more confusion than before with the new framework getting told that will not be the future plan of things.

I did not mind the new framework but the new vs classic is a thing that has to end one way or another. If the choice is classic then fix it how you want it and let the new die.

You mean me ?
I don’t work there any more so I cant do anything about this
Based on previously discussed goals I expect that API 2.0 will be this consolidation

No not you :slight_smile: I meant Xojo !

I know your no longer there so was in no way shooting at you.

Watch XDC live blogs for any more details from the API 2.0 session
https://www.xojo.com/xdc/sessions/info/hill/