1,874 karma · joined Jun 12, 2019 (7y ago) · 701 submissions
[ my public key: https://keybase.io/thinkharder; my proof: https://keybase.io/thinkharder/sigs/Ibpz0COsvz2qYl2K8YfzrhucHf2rcZIxityh5WvYC_k ]
comment 4y ago · link · parent
comment 4y ago · link · parent
comment 4y ago · link · parent
comment 4y ago · link · parent
But yeah, for game development pure FP is probably a bad fit because you need pretty precise control over memory allocation and layout (from what I understand, never actually done any game dev).
comment 4y ago · link · parent
I disagree. One of the most significant benefits of FP (and pure FP in particular) is being able to deal with mutable state safely in concurrent programs. This is essentially the core problem which effect systems try to solve.
comment 4y ago · link · parent
comment 4y ago · link · parent
comment 4y ago · link · parent
comment 4y ago · link · parent
comment 4y ago · link · parent
1. You want to convert people to "pro" users so you try to show them all the money they can save by doing so.
2. Because of a bug in the code somewhere, you end up showing the discounted price in the cart until checkout.
3. Because some number of people don't pay attention and don't realize the switcheroo happens at the end this bug actually increases conversion.
4. Someone eventually notices the bug (after customers like you complain about it!).
5. When they fix it the metrics are adversely impacted.
6. The bug is now a "feature".
This is of course all very shortsighted since you are essentially burning customer trust for a short-term gain in conversion so it's bad for the medium/long term business. But the team has to hit its KPIs, which are tracked on a daily/weekly basis!
comment 4y ago · link · parent
``` let locked = std::sync::RwLock<Foo> = ...;
let lock = locked.write().unwrap();
bar.doSomethingAsync().await ```
will complain because `std::sync::RwLockWriteGuard` is not send. Just looking at the code it is not really clear why it should need to be. To understand why, you need to understand how the compiler transforms this code into a state machine and capture everything in scope of an await point in Struct that must be send (since it can shift to new thread when resuming). It makes sense when you understand what's happening under the hood but can be a bit baffling when you are starting out.
comment 4y ago · link · parent
comment 4y ago · link · parent
comment 4y ago · link · parent
Java was an OO, garbage collected language that supported (sort of...) hot swapping code. Go was a reasonably performant, garbage collected language that compiled to static binaries and has great cross-platform support. Some grad student decided to write Spark in Scala so you had to use it for Spark jobs Rust is a systems programming language with zero-cost abstractions and no GC that allow you to write mostly memory-safe code.
What is the killer feature of OCaml that makes it worth the investment?
comment 4y ago · link · parent
But what is the theoretically correct price of Bitcoin? In some sense it's just like every other asset, the right price is what someone else will pay for it. But what you actually care about is what someone will pay for it 1/5/10 years from now (especially if you plan to use it as a store of value). And how do you even begin to model that?
comment 4y ago · link · parent
comment 4y ago · link · parent
When you would use JSON over HTTP vs gRPC? I can think of a couple cases:
1. Your infrastructure doesn't support HTTP/2 with trailers.
2. You need to send/receive payloads that aren't well-defined. The nice thing about JSON vs protocol buffers is that JSON is self-describing and flexible. In most languages you have libraries which can deal with JSON as essentially a Map<String,Object>, with maybe a nice cursor API that allows you to pick/update specific fields without knowing anything else about the object structure. You can encode the JSON AST in protocol buffers but it will not be very nice I don't think.
3. You want your wire-format to be human readable for some reason. You can technically do this with gRPC as it is not strictly tied to protocol buffers as the wire format for messages, but in practice it is kind of a pain and language support for doing it can be spotty. At the very least you have to figure out how to do it as protocol buffers is very much the default.
4. The code-generated classes/structs from gRPC IDL are often quite bad to work with. If you've ever used the case classes generated by scalapb (Scala) or the structs generated by Prost (Rust) then you know what I mean. You end up having to create a parallel set of data structures for your protobuf message types to keep yourself sane. With JSON on the other hand, you can typically create classes/structs which are nice to work with internally but also directly serializable to JSON.
All that said, gRPC is really nice. If I am bootstrapping a project, gRPC is definitely the default and I need a good reason to use anything else.
comment 4y ago · link · parent
comment 4y ago · link · parent
Setting that aside though, the author seemed to mostly be talking about architectural simplicity in the article. He specifically called out "premature move to microservices, architectures that relied on distributed computing, and messaging-heavy designs" which I think is spot on. Distributed systems are fundamentally hard and involve a lot of difficult tradeoffs. But somehow we have convinced ourselves as a profession that distributed systems are somehow easier.
comment 4y ago · link · parent