9 comments

[ 6.4 ms ] story [ 15.6 ms ] thread
I hope nobody is counting javascript as a functional programming language. You can however write pretty decent functional code in C#.

I ported a 10kloc F# codebase to a very alien-looking functional-style C#. The project was processing several hundred thousand dollars woth of transactions per month and the go-live went flawlessly. I have since left the employer but am aware the code is still in production two years later and the C# devs over there almost never had to reach out for my help.

The long list of limitations C# has over F# is lead by: lack of first-class algebraic datatypes.

Javascript isn't 100% functional, but the functional paradigm is a founding pillar of the language. Many of JS's best patterns are rooted in taking a "functional-like" approach to coding in it (which is reflected in projects like React).
What was the reason for porting to C#?
I attended a few conference/training (POPL/OPLSS) that made me want to pursue more chalenging things in computer science. Among other things my terrible grades in Comp.Sci in the early 2000s required me to do another bachelor's degree to open up masters/phd programs. In other words I was leaving the company.

Not a single developers there had bothered (such a bother /s) to learn F# and I wanted to make sure they didn't depend on me. It all worked out perfectly because the math degree turns out to be much more challenging than computer science.

Unfortunately developers overestimate the amount of work required to learn a new programming language. In particular ones on the same platform (say F# on .NET for a C# dev). It turns out that learning the libraries takes years but learning a new PL takes but a couple of days of focused efforts.

(comment deleted)
Thank you Dan. This post was a great piece. Being a person that truly admires you, and now knowing that there are actually a couple of things that I appearantly know more of than you. Your inspiration is even greater now.
> “don’t put loops inside loops”

Whoa! That’s exactly what I got from my one semester course in Algorithms. (tries to actively hide shame)

Kind of dumb as an ideology. Sometimes you need N^2 and N is small anyways.
Man if Dan doesn’t know about all thouse stuff, I guess I shouldn’t feel bad for not knowing the stuff I don’t know.