General-purpose languages eat everything around them
Why? Turing-complete languages are universal machines:
- They can replace any domain-specific language.
- They transfer optionality from the platform implementation to 3rd party developers.
Once upon a time, there was a clever young woman who lived in a cottage by the sea, building an application platform.
Every day she would tend to the platform gently, adding features to a domain-specific language one by one, watching how the platform would respond and grow. Every day, she pruned the implementation, improving its performance.
She was thoughtful, so she knew that building a platform was like growing a garden (architects vs gardeners). Markets could be trained, but not planned. Cultures could be grown, but not commanded into existence. She knew her platform was a undergoing constant evolution, and filled with agents who would react to change. There were , so Goodhart's law ruled the day.
Life continued like this. Each day she cultivated her application platform, and each day it flourished a little more.
Then one day, she realized her ecosystem had grown so much that she could no longer keep track of the use-cases. The feature requests were greater than she could count! Click states, hover states, touch gestures, different controller types, reacting to user input... How would she fit all of these use-cases into her domain-specific language?
The following day a peddler came to her cottage, dressed in rags, and selling trinkets. Among the wares was nestled a small black box, the lid sealed with wax.
"Ah! This magic black box contains a Turing-complete scripting language. Open the box and all your ecosystem's problems will solve themselves. But I warn you — a Turing-complete spirit never travels alone. Once out of the box, it won't want to get back in."
The young woman, at her wit's end, took the Turing box and pried open the lid. Out rushed a Turing-complete spirit. Instantly, her ecosystem was transformed!
Wherever Turing-complete touched her domain-specific language, it was transformed into a 3rd party library! Permissionless innovation spread, and 3rd party libraries sprung up like weeds, creating features from nothing.
But chained to the tail of Turing-complete were 3 evil spirits — Performance, Privacy, and Security.
"Haha! Turing-complete may have transformed your ecosystem, but it is also under our curse! Wherever Turing-complete goes, we go. Whatever Turing-complete transforms, we spoil. You have transferred optionality from the platform to the scripting language and so you will be plagued by performance, privacy, and security problems forever!"
The young woman tried to force the spirits back into the box, but to no avail. Wherever Turing-complete went, the ecosystem flourished, but performance, privacy, and security problems sprang up too.
The next year the peddler came back. The young woman ran to him, saying "Turing-Complete has blessed my ecosystem, but everywhere it goes, it drags these 3 demons with it. Tell me peddler," said the young woman, "who can break their curse?"
"Ah young woman! I see you have opened the box. With all Turing-complete spirits come the blessings of permissionless innovation, and also these 3 curses. The curses cannot be broken. Once you transfer optionality from the platform to the scripting language, the deal cannot be undone. Never again will you go back to your domain-specific language.
"But all is not lost... East of the sun and West of the moon there are 3 mountains. In the heart of these mountains are 3 amulets: Sandbox, Neverslow, and Incentive. To obtain the amulets you must complete many trials. The amulets cannot break the curse, but they can tie the hands of the demons."
Over the years, the young woman went through many trials. She obtained the amulets, subdued Performance, Privacy, and Security — though never completely. Yet, her domain-specific language was gone forever, replaced by the magic of the black box, and when she returned home, she was a different person.
That is the way of things in real life. Fairy tales have a happy ending, but real life is full of incomplete solutions.
Advantages of declarative, domain-specific languages (DSLs):
- Sidesteps security, privacy, and performance problems.
- Implementation is decoupled from intent. The platform/OS has the option to optimize the performance of the implementation over time.
- Accessibility and other features can be baked into the language, rather than bolted on as a feature.
Problems with general-purpose languages (GPLs):
- Security, privacy, and performance problems. They can be mitigated with difficulty, but are at some fundamental level, unresolvable.
- A Turing-complete script is a black box. There could literally be anything in there. The platform can't optimize, reimplement, or recontextualize scripted applications for other contexts (accessibility) without risk of breaking things.
The one massive advantage of a general purpose language: permissionless innovation. 3P developers can and will build anything they want.