"RokuMarkn" wrote:
I'd tentatively suggest the code should be redesigned if you need to check things like that. Perhaps there's a good use case for keeping different types in the same variable but offhand I can't think of one. I certainly have never had the need to check types at run time, except to distinguish messages returned from Wait().
"RokuMarkn" wrote:
I'd tentatively suggest the code should be redesigned if you need to check things like that. Perhaps there's a good use case for keeping different types in the same variable but offhand I can't think of one. I certainly have never had the need to check types at run time, except to distinguish messages returned from Wait().
--Mark
"EnTerr" wrote:
Mmmm, good point.
I see roPath does ifString but who does ifInt (but roInt)?
"EnTerr" wrote:
Personally per my Python exposure i am fan of "duck typing" ("if it walks like a duck and swims like a duck and quacks like a duck, i call that [type] a duck"). In other words if the type can perform the duties of a String, for all practical purposes it is a string. Which i can probably check if the value can/has ifStringOps, to be more precise.
"TheEndless" wrote:
As I mentioned earlier in this thread, there's at least one roXXXXEvent type that implements ifInt.
I have some serialization methods that don't trust "duck typing" for obvious reasons. I also have some casting/conversion functions that need to know the real type.
vals = [false, 0, 0.0, 0d]
ifcs = ["ifBoolean", "ifInt", "ifFloat", "ifDouble"]
for each val in vals: for each ifc in ifcs: ? type(val,3), ifc, getInterface(val, ifc): next: next
vals = [false, 0, 0.0, 0d]
ifcs = ["ifBoolean", "ifInt", "ifFloat", "ifDouble"]
FOR EACH val IN vals
FOR EACH ifc IN ifcs
? type(val,3), ifc, getInterface(val, ifc)
NEXT
NEXT
"EnTerr" wrote:"TheEndless" wrote:
As I mentioned earlier in this thread, there's at least one roXXXXEvent type that implements ifInt.
If by any chance you ever recollect (or re-encounter) which one, pls let me know - i am most interested to explore it
"EnTerr" wrote:I have some serialization methods that don't trust "duck typing" for obvious reasons. I also have some casting/conversion functions that need to know the real type.
Huh. That's actually very un-obvious to me. Can you give me some examples, practical things that caused your mistrust?
"Komag" wrote:
I don't recognize the "next"s - they replace END FOR? Are they more useful in some way, such as helping with some version of EXIT FOR or other option?
"Komag" wrote:
Is your code spaced out like this? I don't recognize the "next"s - they replace END FOR? Are they more useful in some way, such as helping with some version of EXIT FOR or other option?