Bitcoin doesn't take into account that humans are forgetful.
If you forget your bank card pin code they would post you a new card and pin, if you phone them up. I've done this a couple times in the past pre-smartphone banks.
If you forget your bitcoin password you are never getting access back.
Sorry, this is going to be a slightly longer reply since this is a really interesting question to ask!
Elixir (and anything that runs on the BEAM) takes an entirely different perspective on concurrency than almost everything else out there. It still has concurrency gotchas, but at worst they result in logic bugs, not violations of the memory model.
Stuff like:
- forgetting to update a state return value in a genserver
- reusing an old conn value and/or not using the latest conn value in Plug/Phoenix
- in ETS, making the assumption nothing else writes to your key after doing a read (I wrote a library to do this safely with compare-and-swap: https://github.com/ckampfe/cas)
- same as the ETS example, but in a process: but doing a write after doing a read and assuming nothing else has altered the process state in the interim
- leaking processes (and things like sockets/ports), either by not supervising them, monitoring them, or forgetting to shut them down, etc. This can lead to things like OOMs, etc.
- deadlocking processes by getting them into a state where they each expect a reply from the other process (OTP timeouts fix this, try to always use OTP)
- logical race conditions in a genserver init callback, where the process performs some action in the init that cannot complete until the init has returned, but the init has not returned yet, so you end up with a race or an invalid state
- your classic resource exhaustion issues, where you have a ton of processes attempting to use some resource and that resource not being designed to be accessed by 1,000,000 things concurrently
- OOMing the VM by overfilling the mailbox of a process that can't process messages fast enough
Elixir doesn't really have locks in the same sense as a C-like language, so you don't really have lock lifetime issues, and Elixir datastructures cannot be modified at all (you can only return new, updated instances of them) so you can't modify them concurrently. Elixir has closures that can capture values from their environment, but since all values in Elixir are immutable, the closure can't modify values that it closes over.
Elixir really is designed for this stuff down to its core, and (in my opinion) it's evident how much better Elixir's design is for this problem space than Go's is if you spend an hour with each. The tradeoff Elixir makes is that Elixir isn't really what I'd call a general purpose language. It's not amazing for CLIs, not amazing for number crunching code, not amazing for throughput-bound problems. But it is a tremendous fit for the stuff most of us are doing: web services, job pipelines, etc. Basically anything where the primary interface is a network boundary.
Sort of. That used to be the case, and it's still what they teach on those courses. However there are now "20mph zones". These are signed on entry, but do not have the repeated small 20 signs of a normal 20mph limit. This means that you can no longer tell whether you are in a 30 or a 20. I have once seen something marked as a "40mph zone" but I suspect that this was a local aberration and did not have a similar rule.
Crunchbang was such a good distro! I ran linux for about seven years. Ubuntu and then Crunchbang. Had my 2012 MacBook Pro dual boot into Crunchbang. Battery life was awful. It had no automatic fan control, so the laptop got so hot I could barely touch it. I ended up writing a bash script to manually control the fans using function keys https://gist.github.com/nwjlyons/b29ee6f7e26595f55a2a
As cool as it was, I can't be bothered with any of that these days. Just give me a Macbook Pro, as I know it will work and have amazing battery life!
Golang will panic with a runtime error index out of range if you index out of bounds. There doesn't seem to be a nice built in way to do `arr.get(3)` like in Rust.
slice := []int{1, 2, 3}
i := slice[3]
fmt.Println(i)
GC is not relevant in this case, it's about whether you can make structs fit in cache lines and CPU registers. Mechanical sympathy is the googleable phrase. GC is a few layers further away.
> really hard to cultivate a community of people who have a deep love for something, but for some reason can't see what is actually wrong with it that drives ppl away
If you forget your bank card pin code they would post you a new card and pin, if you phone them up. I've done this a couple times in the past pre-smartphone banks.
If you forget your bitcoin password you are never getting access back.
reply