Inconsistent safe cast behavior

26 views
Skip to first unread message

John Hattan

unread,
May 14, 2015, 10:59:27 PM5/14/15
to haxe...@googlegroups.com
Just had an odd runtime exception with my stuff on HTML5 with safe casts. Here's a minimum case. . .

class Foo
{
}

var foo1:Foo = null;
var foo2:Foo = cast(null, Foo);

The first one works fine on everything. The second works on everything (I've tried) but Javascript, which throws a "cannot cast" runtime error.

IMHO, both should should be okay and equivalent, as a "value null of type class Foo" in both cases.

Reply all
Reply to author
Forward
0 new messages