reflaxe.CPP icon indicating copy to clipboard operation
reflaxe.CPP copied to clipboard

Reflection / Serialization

Open alienself opened this issue 2 years ago • 3 comments

Hi again :)

How to handle reflection and serialization in this project? Is this possible / supported or any recommended libs? If possible, is it also possible to reflect extern class (c++ classes defined in haxe)?

If I use the following I get:

haxe\std/haxe/Serializer.hx:75: characters 2-27 : Dynamic not supported. Consider using Any or generics instead?

import haxe.Serializer;
import haxe.Unserializer;

 var serializer = new Serializer();
    serializer.serialize("foo");
    serializer.serialize(12);
    var s = serializer.toString();
    trace(s); // y3:fooi12
    ```

alienself avatar Apr 30 '23 23:04 alienself

This project is currently incomplete! The Dynamic type and anything that uses it is currently unsupported, but that will change eventually.

You can define extern classes and they should work no problem!

SomeRanDev avatar May 01 '23 06:05 SomeRanDev

Ah that's good to know! Hmm that's really interesting because technically this project doesn't really need most Haxe standard libs and could rely more on C++ libs. I will try using my own C++ serializer as an extern class.

How is the state of the reflection system though? I would like being able to export a list of all classes with their properties (type, name, default values) and methods at compile time. Is that something possible right now?

alienself avatar May 01 '23 16:05 alienself

It's not possible right now, it will be eventually.

SomeRanDev avatar May 01 '23 20:05 SomeRanDev