3 ms·
Rust's serde crate defines a bunch of attributes that are commonly used: https://serde.rs/attributes.html https://serde.rs/attributes.html For example: * Rena
by lawn 2y ago
Rust's serde crate defines a bunch of attributes that are commonly used: https://serde.rs/attributes.html https://serde.rs/attributes.html
For example:
* Rename keys to lowercase, uppercase, snake_case, etc.
* Deserialize incoming data with a "type" field that specifies what enum variant it should target.
* Default to a value if the key doesn't exist.
* Skip serializing if it's None (or include it).
* Skip a field completely.
And the list goes on.
With a declarative macro system all attributes are immediately visible so I know what to expect but with Gleam I'd have to carefully read through the code every time to understand what it does. There's a ton of cognitive overload here that doesn't have to exist.
Remember that it's user data we're parsing so we'd have to maintain (update and debug) the code continually, which means reading through the boilerplate again and again.