4 ms·
You're right that the “clever” tricks that dynamic languages allow (and, to varying degrees, encourage) make programs less easily comprehensible for humans and
by catnaroek 11y ago
You're right that the “clever” tricks that dynamic languages allow (and, to varying degrees, encourage) make programs less easily comprehensible for humans and machines alike. However, this is an indictment of dynamism, not cleverness.
As an example of why clever tricks aren't always a bad thing, Haskell's lens library is essentially a big bag of tricks for manipulating compound data structures. However, lens differs from your typical dynamic metaprogramming library in significant ways:
(0) Its design actually follows from a few, simple and very general principles. So you don't need to memorize the entire lens API; instead, you can use the principles to discover the API. The only other thing that offers a similar degree of discoverability is IntelliSense, but IntelliSense for dynamic languages is typically not as good as it is for languages like Java and C# - especially when dynamic metaprogramming is used!
(1) You don't need to resort to arcane reflection hacks to figure out what's going on in lens code. Parametricity (free theorems) and type class laws (provided that you follow them, and this is usually very easy to check) tell you everything you need to know.
(2) Since lenses, traversals, prisms, etc. are ridiculously general, the time and effort you invest in learning them pay off over a wider range of projects.