Earlier quoted context omitted.
Nah, not like it is in Rust. For the vast majority of projects, serde makes parsing / serializing something they don't even have to think about , without having to sacrifice type safety to get there. Until you experience that in a large project with a lot of moving parts and developers, it's hard to appreciate just how many developer cycles you were wasting before on stuff that can be totally automated. It's format-a…
That has been the same in Java and .NET world for 20 years now, just plug the desired serializer from the standard library and be done with it.
The Serde Rust Framework
101–110 of 159 posts
Re: The Serde Rust Framework
#102Earlier quoted context omitted.
Most deserializers in typed languages allow you to deserialize straight into structs or typed objects... Serde just doesn't use reflection to do it.
APIs like GSON and Jackson have a lot more footguns, because (1) they attempt to (de)serialize types whether or not they were ever intended to be (de)serialized, (2) they are missing information about important constraints due to losing information at runtime (the excuse usually used here is that "they don't do validation" when in reality they are violating expectations of package modularity and encapsulation in a pr…
Re: The Serde Rust Framework
#103Earlier quoted context omitted.
APIs like GSON and Jackson have a lot more footguns, because (1) they attempt to (de)serialize types whether or not they were ever intended to be (de)serialized, (2) they are missing information about important constraints due to losing information at runtime (the excuse usually used here is that "they don't do validation" when in reality they are violating expectations of package modularity and encapsulation in a pr…
I’m pretty sure the non-null issue is fixable with a single config option, at least in GSON IIRC.
Re: The Serde Rust Framework
#104Earlier quoted context omitted.
Same is true in any typed language.
I don't think that's true. Or at least we have different ideas about what's being discussed... Let's take JSON or YAML for example: Rust's closest siblings C and C++ are typed, and you get a pretty much untyped messes when working with serialisation or deserialisation. You have to manually inspect every node or write manual ”NodeType" to struct conversation. They allow unwrapping to primitives at best (eg via templat…
Re: The Serde Rust Framework
#105Earlier quoted context omitted.
Please consider giving warp as choice for the web server.
Any particular reason?
So I think the work you are doing is going to be valuable for the community. I guess giving an option between the three popular web frameworks (actix, warp, rocket) won't be so easy as you might have very different way of integrating the authentication etc with each. Probably one way to do this is to keep things more modular so that the authentication can be called independently (among other features).
Re: The Serde Rust Framework
#106Serde is great. I wish it did XML as well but that's a trickier proposition
Re: The Serde Rust Framework
#107I just came from rust to go and… what a disappointment. Missing fields default to some kind of default “zero value” - for any type, even full blown structs. You can’t tell the difference of a missing field or the field having the default value. So if a field has a validation of “must be greater than zero”, you can’t really give a proper error message. If user puts in “0” or omits the field, you always get a value of…
This is a thread about Serde, not how superior Rust and how shitty Go is. We've had more than enough from this ...
Re: The Serde Rust Framework
#108Earlier quoted context omitted.
That has been the same in Java and .NET world for 20 years now, just plug the desired serializer from the standard library and be done with it.
It absolutely does not provide the same guarantees, and I've covered why in several posts now. Do you believe that people who disagree with you have never used any language other than Rust before? Having to deal with data structure invariants getting violated due to reflection is a huge headache and makes the parsers way less useful than they would be otherwise.
Re: The Serde Rust Framework
#109I just came from rust to go and… what a disappointment. Missing fields default to some kind of default “zero value” - for any type, even full blown structs. You can’t tell the difference of a missing field or the field having the default value. So if a field has a validation of “must be greater than zero”, you can’t really give a proper error message. If user puts in “0” or omits the field, you always get a value of…
Re: The Serde Rust Framework
#110Serde solves a lot of problems but using a dedicated macro for it feels like a real missed opportunity compared to using a generic macro for the part that needs a macro (treating structures generically), i.e. what frunk does, and then building serialization as just one of many possible use cases on top of that. Compare how this is done in the Scala ecosystem, where circe-generic is just one of many libraries that use…
On the other hand, Scala's uPickle works almost identically as how Serde does, originally for performance, but the final visitor-based architecture ended up being almost identical. KotlinX serialization works basically the same way too; it definitely seems like a case of convergent evolution