Closed gisikw closed 8 years ago
This is really cool thanks.
Just a couple of issues before i can pull it.
Vectors and Directions are V
and R
respectively after splitting, as it stands both of these types throw errors when you get_type() on them.
Only other thing, which might not be easily accomplished, would be to have some protection against missing or new types. (No idea if that could be done, if not don’t worry about it).
Last thing is there a reason for the ")".
? of is it just left over from previous edits of the script?
Thanks, I'll take a look at vectors and directions shortly. As far as detecting new types, unfortunately I can't really think of a way to make that work. If I can come up with something, I'll gladly PR it later though.
The ")".
is a workaround for a current KOS bug, which I've reported here: https://github.com/KSP-KOS/KOS/issues/1285
Oooh, actually, thinking about detecting new types, it revealed another bug: get_type("LIST") -> "LIST"
. Thinking on it more, I might be able to compare the lex value dumped with the input, to see if there's a difference, which would fix that, but also allow detection of non-string, non-recognized types.
It's likely that this is going to be handled shortly in newer version of kOS once primitive types support suffixes, so I'm going to go ahead and close this PR for the time being.
Another fun library, variable type inference!
Useful for type-checking in other functions in order to fail gently when passed invalid arguments, or to allow functions to operate on both collections and single items.