Conversation

When working on source files with wide-ranging scopes, I wish source editors could pin the declaration lines to the top of the window like section headers, something like this
Embedded video
GIF
92
3,033
"The hardest problem in computer science is naming things", as they say. But it's not only the name itself, but the fact that introducing a name introduces a new vertex of unbounded degree into your program's data and control flow graph.
Quote Tweet
Replying to @kastiglione @jckarter and @hillelogram
The part that really got me, was that small functions make for a graph, but where their execution is linear, you've got an mismatched representation.
3
75
"Write short functions" is a proxy for the higher-order concern of writing good maintainable programs, which is to minimize the overall complexity of those graphs
3
56
it’s also funny that “write short functions” can be actively harmful in languages with more advanced type systems because its like “oh you wanted to factor that code out? goodluck writing the signature...”
1
9
haskell is *more* resilient to this problem because global inference and completely ignoring type representation lets you punt on these problems for internal apis, but swift/rust need to grow crap like existential returns to make factoring tolerable
2
4
but in the case of rust there’s limits where certain type system magicks *only* exist within a single function. For instance Rust provides no way to indicate methods only borrow a subset of fields, but within a function body it naturally understands these disjoint accesses
1
4