Live data from Hacker News

Functional Programming at Facebook

scs.stanford.edu

81–90 of 102 posts

Re: Functional Programming at Facebook

#81
post #28

Earlier quoted context omitted.

Just to double down on the points of some other commenters here: "Functional" is a pretty difficult word to pin down these days. That said, there seems to be a clear camp in what might be better called "denotational" programming which centers around the ML-alike languages, the dependently typed languages, and Scala. Lisp is not much at all like these languages. Nor is Erlang, though it is vastly closer.

I wouldn't call Scala a “functional” language. It's an object-oriented language that happens to be able to encode many Haskell idioms, with varying degrees of awkwardness. But you can write Java in Scala too, and, in the eyes of some, the result will even be more natural. Out of curiosity: Would you consider Prolog a language in which you can do “denotational” programming?

[deleted]

Re: Functional Programming at Facebook

#82
post #74

Earlier quoted context omitted.

http://erlang.se/publications/ericsson_review_axd301_1998012... erlang was literally developed for telephone switches

That's a product from the late nineties. I have no idea how broadly it's used today.

A talk by Joe Armstrong I watched recently indicated that around 50% of 3G and more than that of 4G infrastructure uses Ericsson technology, specifically with swoftware written in Erlang. He made a joke about 'sweating over every bit' sent over the network and then complaining that all the apps are going crazy with their JSON.

https://en.wikipedia.org/wiki/Ericsson#Products_and_services

Re: Functional Programming at Facebook

#83
post #47

Earlier quoted context omitted.

No one is maintaining state by constantly clobbering namespace level variables in Clojure, though. What actually comes into play are ways the language and standard library encourages passing data around and manipulating it, which in Clojure is as immutable as you'll find in any language.

Clojure encourages me to program in the REPL, because there is no other way to know what is going on in such a semantically crazy language, other than trial and error . And the state of the Clojure REPL is as mutable and imperative as it gets, as my paste showed.

You can rebind variables in ghci, too. I certainly wouldn't say this is evidence that Haskell promotes mutable data.

Re: Functional Programming at Facebook

#84

Earlier quoted context omitted.

Clojure encourages me to program in the REPL, because there is no other way to know what is going on in such a semantically crazy language, other than trial and error . And the state of the Clojure REPL is as mutable and imperative as it gets, as my paste showed.

You can rebind variables in ghci, too. I certainly wouldn't say this is evidence that Haskell promotes mutable data.

> You can rebind variables in ghci

No, you can't: http://pastebin.com/SdbKM7V7

In ML and Haskell, a new variable might shadow an old one (if they have the same name), but they are still different variables.

Shadowing is slightly harder to implement than rebinding, but it provides a useful guarantee for the user: the meaning of existing definitions remains stable even if new definitions are introduced into the environment.

Re: Functional Programming at Facebook

#85

Earlier quoted context omitted.

You can rebind variables in ghci, too. I certainly wouldn't say this is evidence that Haskell promotes mutable data.

> You can rebind variables in ghci No, you can't: http://pastebin.com/SdbKM7V7 In ML and Haskell, a new variable might shadow an old one (if they have the same name), but they are still different variables. Shadowing is slightly harder to implement than rebinding, but it provides a useful guarantee for the user: the meaning of existing definitions remains stable even if new definitions are introduced into the environ…

You are correct. I failed to consider the implications of the different mechanics in the repl. I'm inclined to think the clojure repl is more conducive to experimenting. That is, you can change any part of your program to see what happens. I guess one programmer's sandbox is another programmer's hellish nightmare of mutability. For what it's worth, I would never redefine a var actual code, but I can't say it hasn't been done by others.

Re: Functional Programming at Facebook

#86

Earlier quoted context omitted.

> You can rebind variables in ghci No, you can't: http://pastebin.com/SdbKM7V7 In ML and Haskell, a new variable might shadow an old one (if they have the same name), but they are still different variables. Shadowing is slightly harder to implement than rebinding, but it provides a useful guarantee for the user: the meaning of existing definitions remains stable even if new definitions are introduced into the environ…

You are correct. I failed to consider the implications of the different mechanics in the repl. I'm inclined to think the clojure repl is more conducive to experimenting. That is, you can change any part of your program to see what happens. I guess one programmer's sandbox is another programmer's hellish nightmare of mutability. For what it's worth, I would never redefine a var actual code, but I can't say it hasn't b…

> I'm inclined to think the clojure repl is more conducive to experimenting.

I'm inclined to think the Clojure REPL is more conducive to flailing around. Now, this might sound like derision, but it isn't intended that way: Flailing around can be a very time-efficient way to familiarize oneself with an unknown domain, especially if the cost of making wrong design decisions is small.

But at some point one has to consolidate what one already has, and, in my experience, Clojure makes this very difficult.

> I guess one programmer's sandbox is another programmer's hellish nightmare of mutability.

If you absolutely want mutable definitions, you can have them in Haskell (with some noise) and ML (with no noise) too: http://pastebin.com/00ScnFxC . So a Haskell or ML programmer always has at their disposal whatever they think is the best tool for the job.

Can I have it the other way around in Clojure?

Re: Functional Programming at Facebook

#87

Earlier quoted context omitted.

You are correct. I failed to consider the implications of the different mechanics in the repl. I'm inclined to think the clojure repl is more conducive to experimenting. That is, you can change any part of your program to see what happens. I guess one programmer's sandbox is another programmer's hellish nightmare of mutability. For what it's worth, I would never redefine a var actual code, but I can't say it hasn't b…

> I'm inclined to think the clojure repl is more conducive to experimenting. I'm inclined to think the Clojure REPL is more conducive to flailing around . Now, this might sound like derision, but it isn't intended that way: Flailing around can be a very time-efficient way to familiarize oneself with an unknown domain, especially if the cost of making wrong design decisions is small. But at some point one has to conso…

> Flailing around

Haha, yes. This is how I feel about Matlab, actually. But I suppose Clojure is no different in this respect.

I much prefer the Haskell approach: make dangerous things hard to do. Unfortunately, a majority of programmers consider that to be "unpractical".

Re: Functional Programming at Facebook

#88
post #13

> Even though it is probably the most practically used functional language. Scala have 30th place on Tiobe index, while Erlang have 42th: http://www.tiobe.com/index.php/tiobe_index .

Are there people who actually take Tiobe seriously?!

That seems like a very dangerous thing to do to me.

Re: Functional Programming at Facebook

#89
post #74

Earlier quoted context omitted.

That's a product from the late nineties. I have no idea how broadly it's used today.

A talk by Joe Armstrong I watched recently indicated that around 50% of 3G and more than that of 4G infrastructure uses Ericsson technology, specifically with swoftware written in Erlang. He made a joke about 'sweating over every bit' sent over the network and then complaining that all the apps are going crazy with their JSON. https://en.wikipedia.org/wiki/Ericsson#Products_and_services

Erlang is mentioned only once in this entire article, and it's in the "See also" section. Nothing in this Wikipedia article supports the claim that Ericsson uses Erlang at all.

Re: Functional Programming at Facebook

#90
post #31

Earlier quoted context omitted.

Pretty strange that you put Clojure in the "anything goes" category when it has been the clear leader when it comes to immutability. Lots of those languages you put in the other categories don't even have persistent data structures in their standard library.

Here is why: http://pastebin.com/t3Q3CW4j This is particularly infuriating because the proper way to handle bound variables is already known: https://en.wikipedia.org/wiki/De_Bruijn_index .

Interestingly, Scala handles it http://pastebin.com/CT36K6Hj It feels like an artifact of the REPL tho, as one shouldn't be able to redefine x
Post reply on HN