With static vs dynamic discourse back in vogue, time to revive this post: concrete examples of patterns enabled by dynamic typing that are significantly harder in statically typed languages. https://willcrichton.net/notes/idioms-of-dynamic-languages/ …
-
Show this thread
-
In short: - Dynamically-sized heterogeneous data structures (eg JSON) - Ad hoc interfaces / structural subtyping - Reflection - Incomplete programs
1 reply 0 retweets 3 likesShow this thread -
-
Replying to @yminsky
The set I highlighted isn’t exhaustive, but IMO the most important idioms for popular dynlangs in practice. Neither macros nor delimited continuations are going to appear in most Python/Javascript/etc codebases.
2 replies 0 retweets 1 like -
Replying to @wcrichton @yminsky
Macros in particular are interesting because I think they tend to matter more for statically typed languages, as a means of building abstractions that aren’t encodable in the type system.
1 reply 0 retweets 1 like -
Replying to @wcrichton
I'm not sure that's entirely true. In OCaml, I feel like the abstraction tools are powerful in a way that in some sense reduces the need for macros.
1 reply 0 retweets 1 like -
Agreed, macros are not a general necessity but a crutch for less expressive type systems. Eg - Rust macros to stamp out impls for tuples of size 1 to 32 - C macros to emulate polymorphic containers - “deriving” pragmas in most languages
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
cognitive psychology. PhD