Building @:enum abstract with macro?

56 views
Skip to first unread message

Cambiata

unread,
Jun 4, 2016, 4:06:56 AM6/4/16
to Haxe
Is this possible?
Using the standard build macro approach gives "Cannot declare member variable in abstract" error.

Best / Jonas

Alexander Kuzmenko

unread,
Jun 4, 2016, 5:18:23 PM6/4/16
to Haxe
abstract methods should be declared as static methods with additional first argument with abstract underlying type.

суббота, 4 июня 2016 г., 11:06:56 UTC+3 пользователь Cambiata написал:

Dan Korostelev

unread,
Jun 4, 2016, 7:10:46 PM6/4/16
to Haxe
Note that it was changed in Haxe 3.3. There you can build an abstract just like any class - by building syntax-level fields.

воскресенье, 5 июня 2016 г., 0:18:23 UTC+3 пользователь Alexander Kuzmenko написал:

Cambiata

unread,
Jun 4, 2016, 7:54:04 PM6/4/16
to Haxe
Thank you, guys!


Note that it was changed in Haxe 3.3. There you can build an abstract just like any class - by building syntax-level fields.

Great to know that 3.3 supports this!

/ Jonas

Dan Korostelev

unread,
Jun 4, 2016, 8:42:53 PM6/4/16
to Haxe
Well, it was "kind of" supported before, but you had to build an implementation class, not an abstract itself, which means fields become static, methods should take underlying type as the first argument, and they also should have had the @:impl meta.

See this issue: https://github.com/HaxeFoundation/haxe/issues/3514

воскресенье, 5 июня 2016 г., 2:54:04 UTC+3 пользователь Cambiata написал:
Reply all
Reply to author
Forward
0 new messages