3 ms·
A dynamically-typed OO language like Python is very different from a dynamically-typed functional language like Clojure. [1] In a functional language you are m
by djpowell 13y ago
A dynamically-typed OO language like Python is very different from a dynamically-typed functional language like Clojure. [1]
In a functional language you are mostly passing around fairly pure concepts of data as lists and maps, and transforming and combining data between functions. This data is standalone, and serialisable, and so easy to understand; a REPL-oriented environment means that code gets implemented incrementally, building from some inputs to the required result interactively, so everything gets some testing as it is developed.
The static types of this pure data probably wouldn't be very interesting.
Compare with SQL - SQL lets you join and transform arbitrary tables using queries. SQL doesn't require you to create up-front static types to accommodate the shapes of the resultsets of queries that are include joins. The Clojure Way has a lot in common with SQL, I find.
[1] of course there are plenty of large real world systems written in Python etc.
- happy_dino 13y ago> SQL doesn't require you to create up-front static types You realize that DML/DQL is only one part of SQL? It also includes a DDL. All the types are right in there.
- stonemetal 13y agoTry to finish the sentence before deciding it is inaccurate. > resultsets of queries that are include joins. I have never had to use DDL to declare the types of the results of a join. What database do you use where you do?
- happy_dino 13y agoThis is because the types can be derived from the ones declared, not because joins are suddenly “dynamically” typed. Static types != manifest types.
- djpowell 13y agoDDL is boring. DML/DQL are the power of SQL and the relational model. They are what enables ad-hoc querying that the schema designer had never considered. As soon as you do anything other than select * the composite types defined in DDL aren't as important. I was suggesting that the immutable part of FP (which is most of it) has a lot of similarity with relational querying, which is very successful in the real world.