HaxeFoundation / HaxeFoundation/haxe

Array.join() and -dce full issue

Open
#6,841 14 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

https://try.haxe.org/#0Dc93

```haxe
class Foo {
public function new() {
}

public function toString()
return Std.string(Std.random(100) + 100);
}

class Test {
static function main() {
// trace(Std.string(new Foo()));
var foos: Array = [new Foo(), new Foo(), new Foo()];
trace(foos.join('/'));
}
}
```

Results in
```
[object Object]/[object Object]/[object Object]
```

If i uncomment the first trace `trace(Std.string(new Foo()));` i get the expected output (of some random numbers).

```
170
182/170/178
```

Is this expected behavior with DCE, I certainly was surprised by it?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.