Furthermore, like interpreted languages, Dlang compiles very fast because the language implementers believe fast compilation is a core goal.
If you can't get a job in it ( comparatively), can't find quality libraries for common tasks, and don't have a large user base running into painful edge cases before you do, it's going to be a rough ride.
Overtime this knowledge becomes second nature to get used to and less of a pain point to grok.
On the other-hand String has a Deref impl to &str, so you can call any method defined on &str directly from a variable of type String. That doesn’t require any cast, and those methods can be called directly on the variable making it very easy.
To me this feels like a good trade off in ergonomics vs. performance.
You wanted a Map<String, String>, and that's exactly what you should have made. A String is a convenience wrapper for storing a &str on the heap, so storing a String on the heap is redundant. The other options are for performance concerns, which you haven't mentioned any.
Every time I need a static mutable thread safe map in rust for a cache or registry or some such thing, I groan.
I have a love hate relationship with rust. I love a lot of things about it, but sometimes I get so fed up with the borrow checker I drop into unsafe and just write the problem off as something better not done safely.
[0] https://doc.rust-lang.org/std/sync/struct.RwLock.html [1] https://crates.io/crates/lazy_static
I'm using 'static references for the map keys, but they're not really 'static, so I use unsafe transmute to create them and I rebuild the map when the memory map changes to a different address.
TypeScript feels the same way that CoffeScript did 6 years ago: it's a stopgap measure until JavaScript picks up the transpiled language's good features. Also, it's another layer on top of the already unruly JavaScript toolchain.
In comparison, Rust and its toolchain are pleasures to work with. I wouldn't choose to use TypeScript unless there is an explicit requirement to use JavaScript.
Mostly there are diehard haters for JS, not diehard fans.
A lot of people who use JS are pragmatists and fantastic problem solvers that I have a ton of respect for.
-Someone who's not too fond of JS
Of course since it's dynamically typed it's hard to use for larger programs, but TypeScript solves that.
But give me a statically typed compiled language any day!
The browser is so important that we shouldn't be locked into using a single language, so I fully support being able to choose between Rust or a JavaScript!