←back to thread

389 points kurinikku | 1 comments | | HN request time: 0.207s | source
Show context
emmanueloga_ ◴[] No.42168787[source]
Warning: Diving into SCIP/Lisp/Scheme can transform how you think about programming... food for thought is always welcomed! But applying those ideas wholesale to OOP codebases often backfires or gets pushback from teammates. Languages handle paradigms differently, and going against the grain usually leads to worse code.

Example: After Lisp, you might replace every for loop with forEach or chain everything through map/reduce. But unless you’re working in a language that fully embraces functional programming, this approach can hurt both readability and performance.

At the end of the day, it’s grounding to remember there’s mutable memory and a CPU processing the code. These days, I find data-oriented design and “mechanical sympathy” (aligning code with hardware realities) more practical day-to-day than more abstract concepts like Church numerals.

replies(3): >>42169778 #>>42169977 #>>42170173 #
hmmokidk ◴[] No.42169778[source]
The thing is, I find immutable is safer. Less side effects is more predictable. OO is used often when things can just be functions. I love gamedev, and OO makes a lot of sense there because all of the computations and unsafe code is kind of okay. But for webdev FP makes so much more sense. For SAAS something like elixir enables me to write more reliable / less buggy / better tested code.
replies(4): >>42170681 #>>42170743 #>>42171175 #>>42173521 #
anhner ◴[] No.42170681[source]
How do you deal with lack of types? (I know elixir is adding types but from my understanding it's nothing like e.g. typescript)

I'm thinking about learning elixir but lack of types is kind of a turn off for me.

replies(3): >>42171021 #>>42171029 #>>42171169 #
1. shawa_a_a ◴[] No.42171169[source]
Not the other commenter, but my team has been using Elixir in production (soft real-time distributed systems) for several years to great success. The approachable syntax has been great for folks new to the language coming on board and sort of, not realising they’re “doing FP”.

Generally I’d say Elixir’s lack of “hard” static typing is more than made up for what you get from the BEAM VM, OTP, its concurrency model, supervisors etc.

That said if you’re interested in leveraging the platform whilst also programming with types I’d recommend checking out Gleam (https://gleam.run), which I believe uses an HM type system.