Recent submissions

Comment · 6 years ago
For example, if I could push to a Vec while holding a slice to it, that would obviously lead to horrible behavior if the Vec needed to reallocate.

Another example is if someone tried to use a Vec x inside the closure passed to x.drain.

Comment · 6 years ago
Right, but the question was:

> doesn’t Rust refuse to compile even when you use non-concurrency safe objects in a single thread?

and given that most types (Vec, HashMap, etc.) aren't "concurrency-safe" (thread-safe?), your answer

> yes

is rather perplexing.

Comment · 6 years ago
Rust types have markers (Send, Sync) that tell the compiler whether they can be moved across threads, and whether they can be simultaneously accessed across threads.

These markers are irrelevant in a single-threaded scenario.

Comment · 6 years ago
Yep, you can't implement UnsafeCell yourself without running into undefined behavior.
Comment · 6 years ago
Right. The main advantage of Rust is that its thread safety is opt-out (unsafe) rather than opt-in (remember to use the right data structures / locks).
Comment · 6 years ago
It is a convention, not a rule, in mathematics to use (+) to represent operations that are commutative (i.e. abelian) groups.

But this convention is not at all respected in programming (e.g. + for string concatenation in many languages) so I have to admit that it's pretty irrelevant.

Comment · 6 years ago
Literally no "non-tech-savvy" person I know backs up anything at all. I seriously doubt that backup / transfer is on anyone's mind at all when deciding to use a new messenger.
Comment · 6 years ago
Really? I mean, either a few drug dealers slip through the cracks, you fill the nice fun stadium with creepy surveillance cameras to cover your own ass, or the stadium simply doesn't exist. I'm all for options (a) and (c), but option (b) is the worst.
Comment · 6 years ago
Why? I can't think of an alternative that users wouldn't complain about.
Comment · 6 years ago
Great, but this reads like a particularly blunt Amazon ad. Is there a way to achieve "high scalability" without selling my soul to Amazon?
Comment · 6 years ago
For many lying is already a deeply ingrained habit, and for them honesty will take practice.
Comment · 6 years ago
> Reading a few top research papers in a field you're interested in and work through them

Why reading a research paper rather than the more standard approach of reading a textbook?

Comment · 6 years ago
I just started reading, but why does it say "(semi)group" instead of "semigroup / monoid"? I've never heard of inversion being used to perform a fold.
Comment · 6 years ago
How does TypeScript ensure encapsulation if it doesn't have nominal types?

Edit: The article says "magical hidden properties".

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton