Python is not a DSL
Sunday, April 16th, 2023I’m noticing a common anti-pattern of defining declarative DSLs in Turing complete languages — specifically Python — to avoid the overhead of learning new syntax and tools, XML or JSON, and just reusing the Python compiler: Blaze, Airflow, dataswarm. datasets, register_type_info.py for UPM semantic tree, Or Gradle with Ruby.
This is a very bad tech debt that causes massive problems (security, indeterminancy, irreproducibility) and has heavy cost. Never do this. It always leads to a huge expensive effort to redefine the language as its own thing (not Python) that still looks like python, and the team ends up writing a complete parser in addition to everything else. XML is not that hard. Nut up and learn it.
Do not write declarative configs in a Turing complete language.
Do not invent Python subsets for config files.
How many times have you seen someone use a hammer to pound screws because they are a hammer expert, they are comfortable with hammers, they don’t know how to use a screwdriver, and they don’t want to take a week to learn how to use a screwdriver?