Pomsky – A portable, modern regular expression language
Cognition works in two ways: 1) highly deliberate, slow, patient and 2) spontaneous, quick, reactive. I believe software languages do a great job of leveraging both of these capacities of the minds of programmers.<p>The first type of thinking is generally not composed in code. It happens staring out the window, or looking at data tables or lists and reading documentation, drawing out the architecture. The second type happens in code composition: programmers know what snippet will accomplish which outcome, and it just comes out when we know it&#x27;s needed. Boom, we have the thing we imagined during the architecture phase. Maybe we look something up or slow down while writing code, but the composition is fairly reactive&#x2F;spontaneous. It flows.<p>So coding goes in this rhythm... thinking openly and patiently and deliberately, followed by a burst of code composition, and then more open&#x2F;deliberate thought while staring out a window. Again and again. Maybe we reverse some of the quick&#x2F;spontaneous thinking to rearchitect according to our slow&#x2F;deliberate thought.<p>Enter regular expressions. I have never, ever spontaneously composed a regex. I have to be very slow and deliberate. I have to recall the precise definition of every character in the regex as I read or write it. Sometimes I stare at a regex for 2 minutes, look up some operator, stare again for 2 minutes, refactor it. Finally I understand it and can now apply the regex spontaneously to whatever environment I&#x27;m working in. It always feels like first principles architecture, never like flow. This is odd, as regex is like a giant shorthand engine.<p>Maybe I have not yet formed the neurological connections required for it to flow – but more likely this is a function of the language. There must be a syntax that better supports flow-state composition. (I don&#x27;t think Pomsky accomplishes it.)