Hacker News new | past | comments | ask | show | jobs | submit
By a weird stroke of luck, clojure was one of the first languages I learned. And yeah, I guess it left a lasting impact on me in the form of an appreciation for immutability and dataflow programming.

Unfortunately it also left me with an extremely deep distaste for dynamic types, and in particular, the blind usage of lists and maps for everything. The ML family of languages finally gave me a paradigm worth keeping around.

I always thought that a good craftsman knows many tools and techniques, so I learned and practiced everything. My goal was not to leave blank spots on my technology and language map. I learned FP, OOP, and various architectures like DDD, and I did not dismiss any language or major framework. "Every tool has its own place and is useful". Then, after years, I was employed by a company that used Ruby as their main language. "Such beautiful, simple code," I thought. It was a real culture shock for me. Strings and maps everywhere. No types. Monkey patching. No structure. I was really disappointed, but other words come to mind. I quit. So yeah. Once you go to some regions, there is no way back. I wonder how people who started with, for example, Haskell, and were shaped in a correct way, function when they touch other paradigms.
I started learning Clojure when I was 17, but then later moved away from programming. It's done the opposite with me, I struggle to really get the benefit of static types and I still think of everything as maps and functions.
The biggest benefit of static typing is that you automatically know every single operation you can perform on every single result of every single function ever made.
I think an appreciation for static typing comes once you have to start working with code others wrote. I used to write a lot of clojure in my free time, but I think I liked it more because I was the only developer on those projects.

Working professionally in dynamic languages, especially those that use maps in place of objects/records, I would spend a lot of time trying to figure out which keys were present in various input maps. Were they always available or only sometimes? I could either add verify checks at function callsites or trace the map all the way through my code and hope it didn't originate from an undocumented API response.

A few years ago, we started migrating our code from Elixir to Scala. That involved a lot of work creating case class "schemas" for many records that used to be represented by maps. But now it's clear at dev time what data each function receives as input. What fields are required and which are optional. I can write a quick bugfix in a large module that someone else wrote without spending a full day tracing data paths and looking at runtime traces.

Haha same! All you need are primitives and maps and lists and first class functions! (Though good decomposition syntax is up there as well; it can be really helpful for telling what a given thing needs the map to include!)
Awesome, how do you ensure clients of your code always do the correct operations on your data?

With static types it's obvious and you generally have to work hard (and in non intuitive ways) to mess up.

This becomes more important as team sizes grow.

> Awesome, how do you ensure clients of your code always do the correct operations on your data?

Either the data type is opaque (as in you shouldn’t mess with it and you should use the provided api) or it’s just normal primitives and thus no restrictions.

You don’t usually reach into data structures to modify their properties, especially if it’s for foreign modules.

> the blind usage of lists and maps for everything

it's not blind, tho it could seem that way, and if someone hadn't thought deeply abut how they should use lists and maps, then it could be described as being blindly using them.

But this style is also what makes clojure dynamic, and flexible. Updates don't have to be rigid, and keeping backwards compatibility is a lot easier than a lot of statically typed languages.

That's not to say you can't have some rigidity where it's needed (specs for example, can be sprinkled in where you need/want it).