HaxeFoundation / HaxeFoundation/haxe
[python] Inconsistencies with python str class and haxe Class type
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
This code
```
var x:Class = String;
trace(Std.isOfType(str, Class)
```
compiles, but when run it prints False because of how isOfType is implemented on Python
I ran this issue when writing serialization logic where I needed to detect if a Dynamic is a Class object, where isOfType(x, Class) returned False where x is Python str. Ideally, isOfType could returns True for str and other python types that represent extern Haxe classes, or maybe just return if python_lib_Inspect.isclass returns True, but in either case I think this specific example should be consistent i.e. either str is a Class in which case isOfType should return True, or it's not and that first line should not compile.
Contributor guide
Assessment
This issue has not been assessed yet.