HaxeFoundation / HaxeFoundation/haxe
Unconsistent toString and trace on JS and Python (and maybe others)
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
``` haxe
class A {
public function new(){}
public function toString(){
return "my class";
}
}
class Test {
static function main() {
var a = new A();
trace(a);
}
}
```
Tested on what I had nearby
```
$ haxe -main Test -js test.js && node test.js
{}
$ haxe -main Test -python test.py && python test.py
<__main__.A instance at 0x7fcd4b6fd560>
$ haxe -main Test -neko test.n && neko test.n
Test.hx:12: my class
$ haxe -main Test -cpp test.cpp && test.cpp/Test
# some output omitted
Test.hx:12: my class
$ haxe -main Test -java test.java && java -jar test.java/Test.jar
haxelib run hxjava hxjava_build.txt --haxe-version 3201 --feature-level 1
javac "-sourcepath" "src" "-d" "obj" "-g:none" "@cmd"
Test.hx:12: my class
$ haxe -main Test -cs test.cs && mono test.cs/bin/Test.exe
haxelib run hxcs hxcs_build.txt --haxe-version 3201 --feature-level 1
Test.hx:12: my class
```
If you look in generated code there's no call to `toString`, only to `str` in python.
Both js and python issues seems to come from `has_feature ctx "haxe.Log.trace"` - I've found no other references to that feature.
Ubuntu 15.10, Haxe 3.2.1 from PPA
Contributor guide
Assessment
This issue has not been assessed yet.