News for hackers. Stuff that matters.
Re:Rust 2018 survey results by sanxiyn on Tuesday November 27, 2018 @01:40PM (#18545245)
I would not pick Rust over C#/Go/Python for web development.
Re:Rust 2018 survey results by qaq on Tuesday November 27, 2018 @05:57PM (#18547660)
Go? Here's Rust enum for working with JSON

enum Value { Null, Bool(bool), Number(Number), String(String), Array(Vec<Value>), Object(Map<String, Value>), }

How would this look in Go?

Re:Rust 2018 survey results by Matthias247 on Tuesday November 27, 2018 @11:42PM (#18549336)
throwing annotations on structs and letting the library generate suitable serializers and deserializers works reasonably well in Go, as long as the JSON is not too unstructured. The same applies for Java and C# (here the JSON libs might be even better). And obviously for Rust too via serde.
Re:Rust 2018 survey results by qaq on Wednesday November 28, 2018 @06:54AM (#18550827)
Thats a fairly big restriction though and a sign of type system that is not flexible enough.
Re:Rust 2018 survey results by Matthias247 on Wednesday November 28, 2018 @03:28PM (#18555331)
Maybe. However your representation isn't without drawbacks either: All fields are typed by strings, and are thereby not strongly typed. And each additional level (in an array or object) requires mandatory boxing and allocations. The codegen variants on pure structs don't have this drawbacks.

I would say your representation is favorable when someone wants to work with arbitrary JSON in a flexible fashion. However if schemas and code generators are available, I would prefer to use those.

Re:Rust 2018 survey results by qaq on Wednesday November 28, 2018 @03:38PM (#18555410)
Thing is in Rust you can do both
Re:Rust 2018 survey results by happysanta on Tuesday November 27, 2018 @06:00PM (#18547674)
Not proficient in Go but I see an interface{} somewhere in the answer.
Re:Rust 2018 survey results by qaq on Tuesday November 27, 2018 @07:55PM (#18548348)
At which point type safety goes out the window
Re:Rust 2018 survey results by v_lisivka on Tuesday November 27, 2018 @04:05PM (#18546735)
Try percy. It's still in alpha, but it awesome.
Re:Rust 2018 survey results by wild_preference on Tuesday November 27, 2018 @02:37PM (#18545909)
I think "web development" is too generic to say something like that.

I'd consider a small data processing service, maybe a service invoked from the web server you're already using in Ruby or whatever, is a perfectly pleasant place to use Rust, and often likely to be 1:1 identical to those other languages.