←back to thread

296 points gyre007 | 7 comments | | HN request time: 0.711s | source | bottom
Show context
_han ◴[] No.21281004[source]
The top comment on YouTube raises a valid point:

> I've programmed both functional and non-functional (not necessarily OO) programming languages for ~2 decades now. This misses the point. Even if functional programming helps you reason about ADTs and data flow, monads, etc, it has the opposite effect for helping you reason about what the machine is doing. You have no control over execution, memory layout, garbage collection, you name it. FP will always occupy a niche because of where it sits in the abstraction hierarchy. I'm a real time graphics programmer and if I can't mentally map (in rough terms, specific if necessary) what assembly my code is going to generate, the language is a non-starter. This is true for any company at scale. FP can be used at the fringe or the edge, but the core part demands efficiency.

replies(29): >>21281094 #>>21281291 #>>21281346 #>>21281363 #>>21281366 #>>21281483 #>>21281490 #>>21281516 #>>21281702 #>>21282026 #>>21282130 #>>21282232 #>>21283002 #>>21283041 #>>21283257 #>>21283351 #>>21283424 #>>21283461 #>>21285789 #>>21285877 #>>21285892 #>>21285914 #>>21286539 #>>21286651 #>>21287177 #>>21287195 #>>21288087 #>>21288669 #>>21347699 #
Ragib_Zaman ◴[] No.21281291[source]
Perhaps not a satisfactory response but when I start drifting towards thinking FP is fundamentally not as performant as _whatever_else_, I remember that Jane Street uses OCaml basically from top to bottom, and they certainly can't be too slow... Some black magic going on there.
replies(4): >>21281341 #>>21281597 #>>21281921 #>>21287795 #
typon ◴[] No.21281341[source]
Jane Street wrote a compiler that converts Ocaml to Verilog which they run on FPGAs. The OCaml you write in that case is pretty different than what you write for CPUs.
replies(3): >>21281404 #>>21281420 #>>21281448 #
1. throwaway87537 ◴[] No.21281404[source]
Streeter here.

Although I don’t work directly with the FPGA stuff, it’s still a very, very small piece of the overall pie (and new).

The motivation behind using Ocaml is mainly in its correctness(!) not because it’s fast (it’s not). See Knight Capital for a good example as to why. There are great videos on YT by Yaron Minsky that explain this better than I can.

replies(2): >>21282184 #>>21285948 #
2. dooglius ◴[] No.21282184[source]
> See Knight Capital for a good example as to why

Not really, that was about incompatible versions of software talking to each other, which would not really fall under what is meant by "correctness".

replies(1): >>21283049 #
3. fennecfoxen ◴[] No.21283049[source]
While Knight Capital's problem was caused by incompatible versions of the software talking to each other, one of the reasons that happened was the deployment of the code was not correct. The SEC notes:

> “During the deployment of the new code, however, one of Knight’s technicians did not copy the new code to one of the eight SMARS computer servers. Knight did not have a second technician review this deployment and no one at Knight realized that the Power Peg code had not been removed from the eighth server, nor the new RLP code added. Knight had no written procedures that required such a review.

Rumor on the outside suggests that Jane St uses OCaml for things like deploying software.

replies(1): >>21286278 #
4. johnisgood ◴[] No.21285948[source]
Speaking of correctness and performance, was Ada/SPARK ever considered before you guys picked OCaml? Hypothetically, would you consider Ada/SPARK now, especially that SPARK has safe pointers and whatnot?
replies(1): >>21286137 #
5. Jtsummers ◴[] No.21286137[source]
SPARK was barely making waves when they selected OCaml. OCaml was much more established by that time.
replies(1): >>21286307 #
6. gowld ◴[] No.21286278{3}[source]
How does OCaml prevent you from deploying working code that you didn't want to run?
7. johnisgood ◴[] No.21286307{3}[source]
Fair enough. Then they should probably just focus on the second question. :)