396 private links
Note: JS does not have the concept. If we wanted to mutate something, e’d need to put it in an object first, and then pass that object.
Yes, I missed that thought even if I am programming! We simply pass by value often and reassign the function output to a variable.
I’m still not entirely sure what object freezing is useful for — I feel like it’s rarely what you want.
Me too. I never found a good case for it.
I just want to be able to tell if a function is going to mess with its parameters.
It's a way to tell it. Does the parameters are mutated in-place?
To ensure the parameters
In JS, we can freeze an object. The object can be (deep) cloned in Go. ({...o} as shallow clone in JS)
and I think I start to get it: Rust is awesome as interfaces because it can tell from the function signature if it mutates the parameters.
Indeed:
Similar ideas have been around for a while: In 1990, Philip Wadler wrote Linear types can change the world!
About safety in C or C++:
But those languages should be seen as asbestos.
It comes down to the multiple data structures in Rust.
But this complexity is simply a way to encode the reality of dealing with data in a multi-threaded environment, a way that can be checked at compile-time, before the program even gets a chance to run.
When you manage to make the type system work with you rather than against you, you can build things that would be wildly irresponsible to write in C and C++. And that’s the promise of Rust.
Seehttps://anisse.github.io/border-explorer/
Let's see how it goes
How to measure web server capacity resource management: here a quick introduction with Rust snippets.
#idea: rewrite it in JS for backend in JS.
A typical medium-sized Rust service packaged this way weights between 20 and 40 MB before compression and between 8 and 15 MB after compression. Not bad!
It can be useful to recognise and identify files
Another product supporting Rust.
It should provide insights on rust crates.
What bad patterns are encouraged by design in Rust?
- complicated types
- complicated macro
- premature optimizations with lifetimes among others
A text editor... for lawyers.
We have it for developers and for scientists (I mean you LaTeX and Overleaf).
Why not as it can improve their writing.
How a rewrite in Rust is beneficial to read many files? Because it avoids allocation.
Note the program was written once in JS then in Rust.
About using C code:
- there obviously the potential bugs and vulnerabilities in the C code itself and in the code wrapping the C code.
- specific C toolchains, which makes things hard when you do cross compilation.
- you (sometimes) need to deploy the dynamically-linked C library (OpenSSL). It prevents you from using secure FROM scratch container images.
- can't compile it for WebAssembly.
- maintenance! it's hard to review a 2000 line implementation of an encryption algorithm
Pure Rust cryptography is usually around 10-25% slower than an ultra optimized C or assembly code.
Différent ways to handle errors in Rust.