46 karma · joined August 16, 2021
add : Int -> Int -> Int
add x y = x + y
There is no way a function like this can run a Bitcoin miner, all it can do is to return an `Int`. In order to do side effects, a function must return a special `IO` type that should then be returned from `main` (and only then these side effects would be performed).I use Nitter https://nitter.net/
Lol. In my country there is no easy way to do an international bank transfer. Crypto is literally the only solution I can imagine if I want to donate a few bucks to a FOSS project, all other options would be too much effort and too expensive.
Have you tried NewPipe? https://newpipe.net
> the program cannot connect to its database;
> the program cannot write output to disk because the disk is full;
> the program was not started with valid configuration.
I'd prefer Result over exceptions even in these cases. The only case where I think exceptions should be used is when the type system of the language is not powerful enough to prove the validity of some operation. For example in Rust:
let v = vec![1, 2, 3];
let n = v.pop().unwrap();
The `pop` method returns `Option`, but I as a programmer know for sure that the collection isn't empty, I just can't prove it to the compiler. So I use `unwrap` to get the value and panic in the case I'm actually wrong and made a stupid mistake.Another example is division by zero. Using a `Result` as a return value of the division operator would be extremely inefficient and unergonomic. Panic/exception is the best way to handle this situation.
I believe dependent types can solve both of the problems above so we can get rid of exceptions completely. Unfortunately, there is no a single mainstream language that has them.
1. Did a minimal installation without a GUI. 2. Installed Gnome. 3. Installed KDE. 4. Uninstalled Gnome and KDE. The system ended up in a broken state: many important packages were deleted, I couldn't connect to the network, and the package manager stopped working.