List to String for Flash target

58 views
Skip to first unread message

Jean-Baptiste Richardet

unread,
Feb 19, 2014, 8:51:03 AM2/19/14
to haxe...@googlegroups.com
Hi,

I found some weird error today. I created a list of anonymous object (previously typedef):
var selection = new List<Input>();

I added some elements to this list, and then I wanted to trace it:
trace(selection);
// I try this too
trace
(selection.toString());

Then, I got an execution error with a huge stacktrace
[Fault] exception, information=undefined
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:164]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:196]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:196]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:196]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:196]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:196]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:196]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:196]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:196]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:196]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:196]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:196]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:196]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:196]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:196]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:196]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:196]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:196]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:196]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:196]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:196]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:196]
at flash::Boot$/__string_rec()[/usr/lib/haxe/std/flash/Boot.hx:178]


Where does it come from? Is it because my anonymous object?

Thanks,

Jean-Baptiste

ron...@gmail.com

unread,
Feb 19, 2014, 10:14:29 AM2/19/14
to haxe...@googlegroups.com
dce ?

--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/groups/opt_out.

Jean-Baptiste Richardet

unread,
Feb 19, 2014, 10:18:49 AM2/19/14
to haxe...@googlegroups.com
Actually, I'm using OpenFL, but my xml file doesn't mention any DCE. And the generated HXML doesn't have the DCE flag.

I assume I'm using the default.

da...@postite.com

unread,
Feb 19, 2014, 5:07:29 PM2/19/14
to haxe...@googlegroups.com

Default is dce full
Add haxeflag with dce:no in your project.xml

--

David Holaň

unread,
Feb 19, 2014, 7:09:22 PM2/19/14
to haxe...@googlegroups.com
Long long ago in times of haxe 2, i noticed that toString() method of an anonymous object recursively calls toString() for each property and that it blows up if there is a circular reference. Dunno if anything has changed.
-David Holaň

Jean-Baptiste Richardet

unread,
Feb 20, 2014, 4:27:42 AM2/20/14
to haxe...@googlegroups.com
Looks like it didn't change, David. Even with the flag <haxeflag name="-dce" value="no" />, the error's here.
I looked into it step by step, and that's actually the Std.string() on list element that goes into an infinite Boot.__string_rec() hell loop.

Should I abandon displaying anonymous object as String ?

ron...@gmail.com

unread,
Feb 20, 2014, 7:46:31 AM2/20/14
to haxe...@googlegroups.com
strange !
perhaps you could try to rebind toString 
like this
ps: i really don't know what i am doing :)

Cambiata

unread,
Feb 20, 2014, 9:25:25 AM2/20/14
to haxe...@googlegroups.com
...i noticed that toString() method of an anonymous object recursively calls toString() for each property and that it blows up if there is a circular reference. Dunno if anything has changed.

Yep, that has happened for me too, in Haxe 3.

Jean-Baptiste, does it work if you instead try
 trace(Std.string(selection);
?

Jean-Baptiste Richardet

unread,
Feb 20, 2014, 9:30:27 AM2/20/14
to haxe...@googlegroups.com
Nope, same error with
trace(Std.string(selection));

Jean-Baptiste Richardet

unread,
Feb 20, 2014, 9:46:12 AM2/20/14
to haxe...@googlegroups.com
I created a more precise example: http://try.haxe.org/#93bd3
I think the problem comes from the cross reference between Input and Group. Any workaround ?

Juraj Kirchheim

unread,
Feb 20, 2014, 9:48:37 AM2/20/14
to haxe...@googlegroups.com
This has nothing to do with DCE or the like. Std.string in flash just
doesn't guard against deep recursion.

Here is how JS implements it:
https://github.com/HaxeFoundation/haxe/blob/development/std/js/Boot.hx#L82
Here's the flash version, that does no indenting or depth capping:
https://github.com/HaxeFoundation/haxe/blob/development/std/flash/Boot.hx#L163

I would call this a bug, despite the fact that Haxe gives no real
guarantees about how this should behave.

Best,
Juraj
Reply all
Reply to author
Forward
0 new messages