Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _posts/2017-01-31-world-changed.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Moving to Erlang. What if we just took away the guns: no threads, no mutability.
I have to agree I was in the same mind-set about 18 months ago. But I was wrong, and I (happily) admit it. I've been programming for a long time, and I felt like I was blindsided, why didn't I hear about this before? Because I had mistakenly assumed the world was the same - it is not.

What happened: Moore's law ends, lots of memory, speed, concurrency everywhere. Simple networked services that run reliably for long periods - sound familiar?
Languages like Haskell don't even know what we're talking about. Haskell takes one step further than Erlang and says not only is the language immutable, the functions are really mathematical functions. That means if you pass f(1) into a function f and it returns 42, then it should always return 42 given the input of 1. Erlang thinks this is going to far. To an Erlang programmer Haskell is an impractical language. How can you make a function to get the current time?
Languages like Haskell don't even know what we're talking about. Haskell takes one step further than Erlang and says not only is the language immutable, the functions are really mathematical functions. That means if you pass f(1) into a function f and it returns 42, then it should always return 42 given the input of 1. Erlang thinks this is going too far. To an Erlang programmer Haskell is an impractical language. How can you make a function to get the current time?

## So, what happened?

Expand Down
8 changes: 4 additions & 4 deletions _posts/2021-12-14-functional-programming-is-a-lie.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ In the early days of computer science, a lot of work was done to try to use math
There's no exact definition of fuctionally pure purity, but generally it's these things:
* Immutable state / data,
* No side-effects
* First class functions (functions can treated as data)
* First class functions (functions can be treated as data)
* etc.

Javascript is a functional language. Why isn't it a *pure* functional language?

* Javascript fails purity because it allows for mutation of state and side effects - most mainstream language fail for this same reason: Java, Go, C#, Rust, Python, Ruby, etc.
* Rust fails pureity because it has unsafe modes and allow side effects
* Javascript fails purity because it allows for mutation of state and side effects - most mainstream languages fail for this same reason: Java, Go, C#, Rust, Python, Ruby, etc.
* Rust fails purity because it has unsafe modes and allows side effects
* Erlang and Elixir fail this test because they allow side effects

What is immutable data and what is a side effect?
Expand Down Expand Up @@ -105,7 +105,7 @@ Here's what the list of functional languages should look like:

I can hear a thousand developer's voices calling out that: Yes, but Rust, Clojure, etc., have immutable data constructs and that if you just keep your mutations under control and in a box then you're ok.

Reflected by this statement: "Mutation is a reality, the correct approach is disciplined mutation. "https://news.ycombinator.com/item?id=18044656
Reflected by this statement: "Mutation is a reality, the correct approach is disciplined mutation." https://news.ycombinator.com/item?id=18044656

Maybe this discussion is for another blog, but the reason unsafe modes and mutation exists in these languages is because developers use them - and often use them incorrectly - there are studies that show vulnerabilities due to memory violations are not that uncommon: https://cseweb.ucsd.edu/~yiying/RustStudy-PLDI20.pdf

Expand Down