spatialos-sdk-rs icon indicating copy to clipboard operation
spatialos-sdk-rs copied to clipboard

Serialisation as a macro?

Open jamiebrynes7 opened this issue 7 years ago • 5 comments

Like https://github.com/serde-rs/serde - the serialisation API surface area is known and well defined

jamiebrynes7 avatar Oct 28 '18 17:10 jamiebrynes7

I'll take a look at this at some point :P

dgavedissian avatar Nov 02 '18 12:11 dgavedissian

Assigned 😛

jamiebrynes7 avatar Nov 02 '18 12:11 jamiebrynes7

Is this still worth looking into this in the future?

Would swap the parts of the code generation from T4Rust to Rust macro syntax - not sure the tangible benefits of this

jamiebrynes7 avatar Feb 13 '19 16:02 jamiebrynes7

I'm not sure doing serialization as a macro makes sense, at least not with how we handle schema data in the SDK right now. Using a macro (specifically a custom derive procedural macro) would make sense if we wanted to define our component types in Rust code and then generate the schema file and related types from there.

I spoke with an engineer at Improbable a while back who mentioned that something similar to this was being investigated for the Unity GDK, so it may be worth investigating for Rust, too. I know I would certainly like to write my types in Rust instead of schemalang 😅


Regardless of whether we're defining our schema types in Rust or schemalang, I think it will make sense to move away from T4Rust and towards something better supported by the Rust community. Specifically, syn and quote are the de facto standards for code generation in Rust right now.

randomPoison avatar Nov 01 '19 23:11 randomPoison

Regardless of whether we're defining our schema types in Rust or schemalang, I think it will make sense to move away from T4Rust and towards something better supported by the Rust community. Specifically, syn and quote are the de facto standards for code generation in Rust right now.

I 100% agree with migrating off T4Rust. Its hard to read and hard to debug.

I know I would certainly like to write my types in Rust instead of schemalang

This could be a fun experiment. :smile:

jamiebrynes7 avatar Nov 02 '19 14:11 jamiebrynes7