Features of a dream programming language: 3rd draft
Tags: functional, programming, computerscience, webdev
Published: 2023-03-27 20:25:50

This article is [originally published](https://magnemg.eu/features-of-a-dream-programming-language-3rd-draft) on my blog https://magnemg.eu/

Have you ever dreamt of what features your ideal programming language would have? Have you ever tried to make a list of the best features (or non-features) of existing languages that are particularly inspired in some way...?

This article explores and lists features of an ideal programming language, focusing on readability, reasonability, and fast onboarding. It emphasizes the importance of the alignment between execution order and reading order, and the ability to trace the flow of execution by simply reading the code chronologically. The desire is to utilize Functional Programming (FP), while alleviating [the weirdness of FP](https://probablydance.com/2016/02/27/functional-programming-is-not-popular-because-it-is-weird/) through taking inspiration from OOP in areas such as ease of domain modeling, and Alan Kay's vision of scalable computing. The article also talks about the importance of some esoteric features, such as evolvability, content-addressable code, and transparent upgrades. It begins by outlining some general guiding principles, such as that all programming languages are built to overcome human limitations, not machine limitations.

---

# Table of Contents:

* [Summary](#summary)
* [Prelude](#prelude)
  * [Guiding principles](#guiding-principles)
  * [Purpose: What would the language be for?](#purpose-what-would-the-language-be-for)
* [Readability & reasonability](#readability-amp-reasonability)
  * [Syntax, composition](#syntax-composition)
  * [Execution model](#execution-model)
* [Safety & correctness](#safety-amp-correctness)
  * [Data types, type system](#data-types-type-system)
* [Maintainability, refactorability, reuse](#maintainability-refactorability-reuse)
* [Performance](#performance)
* [Tooling](#tooling)
* [Ecosystem](#ecosystem)
* [Sobering notion](#sobering-notion)
* [Future reference / reading](#future-reference-reading)
* [The Hairy Vision](#the-hairy-vision)
* [The End](#the-end)

---

# Summary

I long for a very constrained language for web-app + systems development, prioritizing readability (left-to-right and top-down) and reason-ability above all, which is designed for fast onboarding of complete beginners (as opposed to catering to a specific language community who already have the [curse of expertise](https://en.wikipedia.org/wiki/Curse_of_knowledge)).

**FAMILIAR** features it should have (the most important ones):

* Functional Programming, but based on data-first piping.
    
* Immutability, but w/ opportunistic in-place mutation.
    
* Gradually typed: dynamic for development, static for production (w/ fully sound type inference).
    
* Concurrency via goroutines and (the async) unbounded buffered channels.
    
* Ecosystem: interoperable with existing languages.
    
* Transpiles to JS and/or compiles to WASM.
    
* Adaptive runtime.
    

**ESOTERIC** features it should have (the most important ones):

* Crucial evolvability / backward- and forward-compatibility.
    
    * Content-addressable code.
        
    * Transparent upgrades without any breaking changes.
        
* Data First Functional Programming w/ SVO style syntax: `subject.verb(object)`
    
* Interpreted, for development. But compiled, incrementally, for production.
    
* Interactive: facilitates an IDE-plugin (VS Code) that shows the contents of data structures while coding. Enable REPL'ing into a live system.
    
* Aggressively parallelizable and concurrent. Inspired by Verilog and Golang.
    
* Scales transparently from single CPU to multi-core to distributed services, without the language necessitating a refactoring of the code.
    

**OTHER** features it should have (a short-list of some familiar ones):

* Eager evaluation (strict, call-by-value), Strong & Static Typing with Fully Sound Type Inference, Generics, Algebraic Data Types (ADT), No Null, No Exceptions by default, No undefined behavior, No Garbage Collector (GC), Async via a blocking/sync interface but non-blocking I/O, Reliable Package Management, Tree Shakeable, Serializable, Helpful Error Messages, Good Interoperability, and First-Class Functions and Higher-Order Functions (HOC), of course (since FP).
    

**DEFAULT** features it would be *nice-to-have* and align the language towards (instead of as special cases):

* **Async, Event-driven, Streamable, Parallelizable**, all by default. Which would effectively take these concerns out of the equation, freeing the application programmer from thinking of implementation details (like how the computer should work efficiently, which is the language/framework designer's job), to _restructuring or rephrasing the problem into sub-problems_, and making those explicit, so the computer can efficiently parallelize computation at the right points. (Read more under the section on 'Performance'.)
    

**NON**\-features, i.e. features the language should **NOT** have:

* Multi-paradigm, meta-programming, DSL's. (These decisions might be controversial, so search article for these terms to read the reasoning why. I'm always open to change my mind.)
    

The complete set of desirable (or particularly undesirable) features are detailed below (including some limited rationale for each).

---

# Prelude

The original article received some [encouraging feedback](https://twitter.com/yukihiro_matz/status/1451548965019668489?s=20&t=qgCvp6ROsbH7h9Wt5MQDAA) from [Ruby](https://www.ruby-lang.org/en/)'s creator Matz, and positive feedback and excellent critique from [Roc](https://www.youtube.com/watch?v=6qzWm_eoUXM)'s creator Richard Feldman. Since I improved [the original article / 1st draft](https://dev.to/redbar0n/features-of-a-dream-programming-language-cio/) quite a bit, I saved it for posterity, to respect the contents of the original URL (where it may have been shared), and to respect the ensuing [original Hacker News discussion](https://news.ycombinator.com/item?id=29716998) based on it. The [2nd draft](https://dev.to/redbar0n/features-of-a-dream-programming-language-2nd-draft-p7j) greatly expanded the article, based on the feedback and further research.

This 3rd draft now synthesizes the various features into overarching sections, based on overall language goals (thanks to brucou's feedback on the [2nd draft](https://dev.to/redbar0n/features-of-a-dream-programming-language-2nd-draft-p7j)).

The article is a long read, so I suggest first skimming it and dipping into the sections where you find interest or disagreement. Then, if your curiosity is piqued by the ideas, I hope you will take time read it carefully over a few evenings, mull over the ideas presented (a very select few may be novel), consider your own dream language features, and contribute those, as well as your own insights and experience, in the comments below.

Even if you disagree with my wishes, you could treat the list as an overview over many of the language features you ought to consider when designing a programming language. Since this list is effectively a compiled list of a few such feature lists I've come across.

The article is a one part meta-philosophy of programming languages, and one part wishlist based on a study of the good ideas out there. I won't specify a concrete language directly. *“If I had an hour to solve a problem I'd spend 55 minutes thinking about the problem and five minutes thinking about solutions.”* -- Einstein, [commonly attributed to](https://quoteinvestigator.com/2014/05/22/solve/). But I will attempt to give you some ideas on what features I think would be ideal, and why. Maybe some of the many linked resources I've made sure to include will be inspirational in the design of your own language.

---

## Guiding principles

* **All programming languages are first and foremost, in actuality, built to overcome *human* limitations.** (Not primarily for overcoming *machine* limitations. Even though we have historically treated programming languages as tools to tinker with machine/hardware.) If they weren't, we might as well be using a lower-level language like Assembly, or typing 0's and 1's. The machine would be just as happy (or happier) with that.
    
    * Software architecture in general (and frameworks in specific) is *a way to organize the mind* of the developer(s), categorising the conceptual world into what's closely or merely remotely related (giving rise to principles like 'cohesion over coupling' etc.). (This might explain OOP's popularity. Articles like those on [syntonicity](https://t.co/u0EFh15eg7) seem to confirm this suspicion.) The machine would be perfectly content with executing even spaghetti code. *“Any fool can write code that a computer can understand. Good programmers write code that humans can understand.”* ― [Martin Fowler](https://www.goodreads.com/quotes/6341736-any-fool-can-write-code-that-a-computer-can-understand).
        
    * A programming language has certain [affordances](https://www.interaction-design.org/literature/topics/affordances), allowing you to talk specifically about/with some concepts (typically the [first-class citizens](https://en.wikipedia.org/wiki/First-class_citizen) of the language), and *avoid* having to talk about other things (e.g. memory management, language runtime concerns). This does not only apply to [Domain Specific Languages (DSL's)](https://en.wikipedia.org/wiki/Domain-specific_language).
        
    * [The Sapir-Whorf hypothesis](https://en.wikipedia.org/wiki/Linguistic_relativity) (linguistic relativity) is especially applicable to programming: *"each programming language has a tendency to create a certain mind set in its programmers. ... you tend to have a mental model of how to do things based on that language. ... Such a mind set may make it difficult to conceive of solutions outside of the model defined by the language."* - [Dennis J. Frailey](https://www.quora.com/What-did-Alan-Kay-mean-by-Lisp-is-the-greatest-single-programming-language-ever-designed/answer/Alan-Kay-11?comment_id=46099908&comment_type=2)
        
    * **Programming needs to get away from the notion that the programmer is giving instructions to the machine.** Instead, programming ought to be thought of in terms of modelling a set of things that interact with one another (causal relations). The programmer ("software engineer", really) should not need to be an inherent part of that model. The software engineer should develop software by merely supplying the machine with a description of such a model. This was foreseen by the great computer scientist **Edsger Dijkstra**: *«Progress is possible only if we train ourselves to think about programs without thinking of them as pieces of executable code.»* He was thinking in terms of mathematical modeling, and [hated OOP](https://wiki.c2.com/?EwDijkstraQuotes)), but OOP became a success for a reason (human intuitiveness / mental model), and I believe it is possible to marry the two notions (mathematical modeling, through compositional FP, and modeling causal-relations of domain entities, in a way similar, but not equal, to OOP).
        
* Only by accounting for human limitations (like cognitive capacity, and familiarity), could one derive a specification for the ideal programming language.
    
* **A bug is an error in thinking**. Either by the developer, or the language-designer for not sufficiently accounting for human psychology ([Sapir-Whorf: the language you write/speak determine what you can/do think](https://talks.golang.org/2015/simplicity-is-complicated.slide#6)). Even [Dijkstra](https://www.cs.utexas.edu/users/EWD/transcriptions/EWD04xx/EWD473.html) himself equates programming with thinking. Programming does not simply *require* thinking, but *structure* thinking. [Languages guide thought](https://en.wikipedia.org/wiki/Language_and_thought), and what matters is [not only what what programming languages let you do, but what they shepherd you to do](https://nibblestew.blogspot.com/2020/03/its-not-what-programming-languages-do.html). That's why *"You can write good code in this language, you just have to be disciplined"* isn't a good argument, even if it is commonly employed. *"If we were seeking power we would have stopped at GOTO's. ... The point is to* ***reduce our expressivity*** *in a principled way ... \[to\] something which is still powerful enough for our daily uses."* -- [Cheng Lou](https://youtu.be/mVVNJKv9esE?t=914) of ReScript.
    
    * To reduce bugs, a language should ensure **simple, safe, and scalable *ways of thinking***. For instance:
        
        * [Type systems](https://en.wikipedia.org/wiki/Type_system) are a way to use the compiler to help us [verify our beliefs](https://twitter.com/garybernhardt/status/1391800319609171968?s=20) about our own code: they help us think consistently.
            
        * [Closures](https://medium.com/javascript-scene/master-the-javascript-interview-what-is-a-closure-b2f0d2152b36), enables the programmer to specify and share behaviors that are already half-way thought through (i.e. already set up with some external data/state).
            
        * [Transducers](https://medium.com/javascript-scene/transducers-efficient-data-processing-pipelines-in-javascript-7985330fe73d), allows the programmer to define and [compose behaviors/processes](https://youtu.be/6mTbuzafcII?t=145) without having to think explicitly about the particular thing which is behaving. (It's currently only possible for a subset of behaviors, but see the [Qi flow-oriented DSL](https://youtu.be/XkIoGmWkEpM?t=996) for Racket for a potential generalization.)
            
        * [Partial application](https://en.m.wikipedia.org/wiki/Partial_application) allows the programmer to take one grand behavior and break it down into smaller behaviors that can be reused independently (i.e. specialization) or in sequence.
            
        * [Composition](https://wiki.c2.com/?PrimitivesAndMeansOfComposition) allows the programmer to think & build piece by piece, instead of all at once, and without the context influencing too much. It also allows the programmer to reuse materialized thoughts.
            
        * *"*[*Open for extension*](https://youtu.be/ltCgzYcpFUI?t=1421)*, closed for modification"*: A programmer can recognize something useful, and add more pieces to it, without having to change the original thing (e.g. extension methods in C#), and without tying those new pieces too closely with the original thing (e.g. subclassing) which would limit their reuse.
            
* A language determines **WHAT** you can & have to think about, but also **HOW** you have to think about it.
    
* **Prioritize scalability in every facet of the language**: [The '0, 1, or infinity' principle](https://wiki.c2.com/?ZeroOneInfinityRule): *"You will either need zero of a thing, one of a thing, or an arbitrary number of the thing."* So *"Arbitrary fixed limits are a CodeSmell"*. This principle could be applied from everything to number of parameters, length of code blocks and basic language constructs (if-else-if...........else; "else what, now again?"), to sizes of collections (maybe..; array lengths could be supplied as mere hints that the compiler can use for optimization purposes and warn/error if the length is exceeded; but arrays should not be its own hard-coded type since it prevents abstraction and introduces type wrangling/conversions). Inspired by Clojure. Also, if you have one of a thing (a block of code, or whatever), then assume it can become arbitrarily long, and account for that in the design of the syntax (scalability). An example of scalability criteria taken into consideration in syntax formatting can be seen in [the new Prettier ternaries format](https://prettier.io/blog/2023/11/13/curious-ternaries#challenging-criteria). Notably using un-indentation of the false-condition to prevent excessive indentation, since flattened/linear code reads better. Formatting is not a trivial concern, and fast top-to-bottom readability is paramount.
    
* **"Things that are different should look different"**. Counter-inspired by [D](https://ziglang.org/learn/why_zig_rust_d_cpp/#no-hidden-control-flow). Inspired by [Lary Wall on Perl's postmodernism](http://www.wall.org/~larry/pm.html) and [my own frustrations with modern component frameworks like React](https://dev.to/redbar0n/what-happened-to-components-being-just-a-visual-thing-22hc), and my impression that Lisp/Clojure is [perceived as hard to learn](https://dwheeler.com/readable/) because it has [so little syntax](https://dwheeler.com/readable/retort-lisp-can-be-readable.html): when everything [looks the same](https://news.ycombinator.com/item?id=21840137) it [is hard](https://rescript-lang.org/docs/manual/latest/function#labeled-arguments) to [tell things apart](https://www.codeproject.com/Articles/1186940/Lisps-Mysterious-Tuple-Problem). **Syntax matters**, so when people balk at noise like too many parentheses, you ought to listen ([like React did](https://youtu.be/5fG_lyNuEAw?t=798), rather than ignore it, [like Clojure unfortunately did and still does](https://youtu.be/nD-QHbRWcoM?t=606), even though the Lisp inventor [McCarthy didn't even like the S-expressions syntax](https://twitter.com/magnemg/status/1449005438339530754?s=20) himself, and it [likely caused Lisp to lose a lot of potential users](https://news.ycombinator.com/item?id=16011111)). So making a syntax which is easy to pick up for newcomers, is important to [remove friction](https://youtu.be/5fG_lyNuEAw?t=965) from onboarding and thus ensure the growth of the language. Some unfamiliarity to experts is tolerable, since they likely have the [Curse of Expertise](https://en.wikipedia.org/wiki/Curse_of_knowledge) from many other languages, but are also adept at quickly learning new ones. Seemingly silly things can be the barrier between mass adoption and remaining niche. A language should optimize for mass adoption, due to network effects, since then *everyone wins*: learning, communication, portability, ecosystem etc. It doesn't mean pleasing everyone's ultimate desires, just avoid having most people turn at the door. Counter-inspired by Lisp/Clojure, and [Haskell](https://news.ycombinator.com/item?id=12056169). Although it is prize-worthy to **stay very frugal with syntax**, since more syntax necessitates more learning/documentation (knowledge debt, info overload), more avenues for confusion (the best code is no code), and more complications (language intricacies can lead to software intricacies, which can lead to bugs). But most importantly: less syntax enables better **composition** (all things are lego blocks that fit with each other). Inspired by Lisp/Clojure. My philosophy leans more towards [Golang](https://hackernoon.com/the-beauty-of-go-98057e3f0a7d) ([less features](https://commandcenter.blogspot.com/2012/06/less-is-exponentially-more.html), readability is reliability, simplicity scales best) and [Python](https://www.python.org/dev/peps/pep-0020/) ("explicit over implicit", "one way over multiple ways"), than [Ruby](https://m.signalvnoise.com/provide-sharp-knives/) (provide sharp knives) and [Perl](http://www.wall.org/~larry/pm.html) (postmodern plurality, coolness/[easiness](https://www.infoq.com/presentations/Simple-Made-Easy/) is justification enough in itself, aka. [the smell of a toy language](https://en.wikipedia.org/wiki/Ruby_(programming_language)#Early_concept)). Even though I come from Ruby and love it, and also cannot help admiring Lisp for its elegance and [crucial evolvability](https://www.youtube.com/watch?v=_ahvzDzKdB0).
    
* [Programming should be fun and painless](https://youtu.be/doZ0XAc9Wtc?t=1930). Inspired by Ruby.

* **Make it predicatable: Eliminate entropy/chaos/variability.** Reduce choice. Uniformity helps (and "polymorphism" by it's definition smells; "ad-hoc" smells even more). Uniformity enables simple, clear and robust rules to be formed and used, which is well suited for straightforward programming/automation (and maintenance). Variability makes programming harder (e.g. "Did you forget an else-if case? Can you rely on this value being present?"). (Counter-inspired by [JSON not allowing commas after all values](https://c-harrison.medium.com/how-i-learned-to-stop-worrying-and-love-the-trailing-comma-480f3a73d203).) Too often variability is merely accidental complexity in the name of sophistication, done without forethought / holistic design. Variability in a language makes interpreting that language harder (or writing a compiler for it; or using code-as-data/homoiconicity). Predictability is beneficial for both man and machine. [Constraints liberate, liberties constrain](https://www.youtube.com/watch?v=GqmsQeSzMdw). [Premature abstraction](https://wiki.c2.com/?PrematureAbstraction) is [dangerous](https://sandimetz.com/blog/2016/1/20/the-wrong-abstraction). Abstraction is not about power. Abstraction is about reducing expressivity in a principled way: *"If we were seeking power we would have stopped at GOTO's. ... The point is to* ***reduce our expressivity*** *in a principled way ... \[to\] something which is still powerful enough for our daily uses."* -- [Cheng Lou](https://youtu.be/mVVNJKv9esE?t=877) of ReScript. Use the [Principle of Least Power](https://wiki.c2.com/?PrincipleOfLeastPower) where possible. Principled abstraction and uniformity enables componentization and [composability](https://wiki.c2.com/?PrimitivesAndMeansOfComposition). Much of the pain in programming languages comes from [harmonizing wildly different forms of abstraction](https://hirrolot.github.io/posts/rust-is-hard-or-the-misery-of-mainstream-programming.html) (too much heterogreneity/entropy from sophistication, in the name of familiarity/easiness). *"A computer language is like a system of tightly intertwined components: every time you introduce a new linguistic abstraction, you have to make sure that it plays well with the rest of the system to avoid bugs and inconsistencies."* -- [Hirrolot](https://hirrolot.github.io/posts/rust-is-hard-or-the-misery-of-mainstream-programming.html#why-rust-is-so-hard). *"It is better to have 100 functions operate on one data structure than to have 10 functions operate on 10 data structures."* -- Alan Perlis' in Epigrams on Programming (1982).

* Make the performant thing the default. Inspired by [QwikJS](https://www.builder.io/blog/qwik-1-2-performance-autopilot). Developers shouldn't need to rewrite/refactor large swaths of their application just to make it performant. There should be one way, and that way should be the correct and performant way. See the point on uniformity and predictability called "Make it predicatable: Eliminate entropy/chaos/variability". Inspired by Rust's 'zero-cost abstractions', but counter-inspired by [Rust's many string types](https://youtu.be/CpvzeyzgQdw?t=436) and [Rust's semantic complexity](https://hirrolot.github.io/posts/rust-is-hard-or-the-misery-of-mainstream-programming.html)).

* **Prefer static over dynamic where possible**. It increases predictability for both humans and the machine. Static typing can predict bugs during development, before deployed to production. A  [less powerful language](https://blog.codinghorror.com/the-principle-of-least-power/) is easier to analyze and build tooling for. A stateless system [is better than](https://youtu.be/PNx9WqQ9QeA?t=124) a stateful one. Similarly, recreating state from a known point ("just restart it") is much simpler and preferable to modifying a dynamic system into a desired state. Especially in [bug reproduction](https://overreacted.io/the-bug-o-notation/). Inspired by React. Counter-inspired by Microservices, Actors and live/REPL programming.
    

---

## Purpose: What would the language be for?

What should this dream language of mine primarily be for?

* Webapp / app + systems development. In Rich Hickey's words: [Information-driven situated programs](https://youtu.be/2V1FtfBDsLU?t=1607). Ideally, also open to extension into [more areas of programming](https://github.com/nagydani/seedling/blob/master/RATIONALE.md).
    
    * Scripting and prototyping, but also scalable to production use (app/webapp)
        
    * Systems development (compiled)
        

I believe there is enough cross-over between web app (in-browser + web server) and systems development that a generally powerful (i.e. Turing-complete) language could address both successfully. The language Go / Golang tries to do that (for web servers and systems), for instance. Clojure (for backend) with the ClojureScript compiler (for frontend) is another example, or similarly F# with the Fable compiler. Though the question is up for debate whether or not it is a good idea, or if we should always have specialized languages for different domains. But I believe there are benefits if we don't have to.

So, from various sources of inspiration, and the aforementioned principles in mind, here is the list of features that my dream programming language would have.

---

Features in **bold** are considered most important. Features are divided into the following sections, based on what all languages ought to address. **Learnability**, **productivity**, and **scalability** are considered cross-cutting concerns, and is thus by and large included within each section.

# Readability & reasonability

* No magic / hidden control. Control-flow should be easy to trace, because it makes it easy to understand and debug. Less magic. Counter-inspired by Ruby on Rails. Inspired by Elixir [Phoenix routing / endpoint plugs](https://dockyard.com/blog/2015/11/18/phoenix-is-not-rails). Testing isolated parts is made possible by explicitness. [Explicit is better than implicit](https://www.python.org/dev/peps/pep-0020/). Inspired by the Zen of Python. Explicitness makes testing isolated parts of the system possible. So Explicit &gt; Implicit, almost always. Because explicitness typically reduces ambiguity and increases predictability. Although you can go overboard with it too, like in programming langauges for enterprise development, where everything tends to become over-specified. Furthermore, implicitness is preferred when one may intuitively and robustly determine the convention through the context, and might as well have an implicit sane default. E.g. `self.` references to access class variables inside the class methods is represent [noise](https://stackoverflow.com/q/68461184/380607), when it could be done as an implicit default. This is counter-inspired by Python, and inspired by Ruby. However, using `self` and `this` are [considered](https://youtu.be/PSGEjv3Tqo0?t=416) [an anti-pattern](https://kentcdodds.com/blog/classes-complexity-and-functional-programming) in general.
    
    * Libraries over frameworks, as a [strongly recommended](http://tomasp.net/blog/2015/library-frameworks/) community convention (since a language cannot prevent the creation of frameworks, afaik). Inspired by Elixir, where its [Phoenix](https://dockyard.com/blog/2015/11/18/phoenix-is-not-rails) framework is a notable exception to the rule. Frameworks typically utilize [inversion of control](https://en.wikipedia.org/wiki/Inversion_of_control) ("don't call us, we'll call you"), and ultimately serve to take away control from the programmer. That creates Stack Traces which are really hard to debug, because they reference the framework and not your own code, [esp. problematic with concurrency](https://youtu.be/PNx9WqQ9QeA?t=646). And when yielding control to various (micro-) frameworks, compatibility becomes a specific issue. The programmer shouldn't ever have to ask: "Is this library/framework compatible with this other one?". Counter-inspired by [JS Fatigue](https://medium.com/@ericclemmons/javascript-fatigue-48d4011b6fc4#.prcj59904). Nor have to ask "Where is the execution path of this program?". Counter-inspired by the magic of Ruby on Rails. When the control is always returned to the programmer (no IoC), he/she may likely mix and match more as pleased, without up-front worrying about compatibility (leading to analysis paralysis).
        
    * No meta-programming / no runtime evaluated macros. No first-class macros (runtime) since it is a powerful footgun, and breaks our principle of "prefer static over dynamic (for predictability)". But the language should possibly have compile-time macros. Inspired by Clojure and [Babel](https://codemix.com/blog/why-babel-matters/). So that the language can be extended by the community, and so that **legacy code could be updated to latest language version by processing the code to transform the syntax (novel feature?)**. Sort of like the polyfilling [Babel](https://codemix.com/blog/why-babel-matters/) does, but in reverse (see [reverse polyfills](https://paul.kinlan.me/the-reverse-polyfill/); polyfills that upgrade/modify/interpret old code for features that are removed from the language, so the language evoution/adaptatino and growth is not impeded by compromises due to eternal backwards-compatibility, yet still prevent breaking old code. See section on 'Backward- and forward-compatible'). Also inspired by [Babel's simple user-defined code transforms](https://twitter.com/peterpme/status/1729518122674073669). The problem with even compile-time macros is that it is hard to combine them with (the preservation of) static typing (i.e. types are not checked). If compile-time macros are included, then it should not be string based (find-and-replace) macros, but based on Abstract Syntax Tree (AST) 'syntax objects', since macros should respect scopes, namespaces etc., and should probably also be [hygienic](https://en.wikipedia.org/wiki/Hygienic_macro) while having some escape hatches (like [syntax parameters](https://en.wikipedia.org/wiki/Hygienic_macro#Criticism)). Inspired by Racket. The problem with compile-time macros for our concerns is that they are essentially direct instructions to the computer (compiler, runtime), which violates the principle of having the computer only indirectly interpret the model (of the system) that the programmer has described (see section on 'Few keywords and operators'). There also is the problem that there is a [formal bound to what macros can do for you](https://youtu.be/43XaZEn2aLc?t=918) in terms of the expressiveness of a language: a macro expansion is syntax sugar, and a language can only express something new if it cannot possibly be macro expanded from something existing in the language. So if we want to allow extending the language easily then maybe instead of compile-time macros then the language should make it easy to create some sort of **compiler plugins** (which are written and run as a separate program). In any case, we want to disallow mixing macros into application code, since they make reasoning about the program and it's control-flow harder, since then what you see may not be what you get.
        
    * **Expressions over statements**. The calling code should always get something back ([Is. 55:11](https://biblehub.com/isaiah/55-11.htm)). Because the result should be able to be further manipulated (chained, for instance). Inspired by Clojure [and Haskell](https://blog.jle.im/entry/first-class-statements.html). Counter-inspired by JavaScript. [Statements suck](https://youtu.be/q3Ies_XTo_s?t=327), as even the inventor of JavaScript, [Brendan Eich admits](https://bugzilla.mozilla.org/show_bug.cgi?id=513379#c21). A goal should be to eliminate the subjective/anthropocentric bias that afflicts programming (especially the Imperative kind), because: *It is not you, the programmer, which should be calling code, but code should be calling code. Code should not terminate in the void, as if it's you the programmer who is at every step acting on the machine. It should be the machine acting on itself. Which it actually is. So this is a matter of fact. But it should also be a matter of our language. So our programming language matches the fact. As programmers we should* ***model/describe causal interactions between entities***\*, not simply encode our own interactions with the machine.\*
        

## Syntax, composition

* **Readability and reasonability** as top priority. Local &gt; Global: The language should afford the developer with the ability to perform **local reasoning** (instead of global reasoning), to only focus on the code at hand (not having to jump around many places or files, and worry about potential 'spooky action at a distance'). Reduce dev mind cycles &gt; reduce CPU cycles. Human-oriented and DX-oriented. Willing to sacrifice some performance, but not much, and not to overly gain comparability with natural language. Counter-inspired by [SQL](https://www.scattered-thoughts.net/writing/against-sql/#complexity-drag). Willing to sacrifice immediate power in the language itself, esp. if that can be achieved through abstracted-away libraries.
    
    * Should always be able to be read top-to-bottom, left-to-right. **The execution order should also always follow the reading order.** No `<expression> if <condititon>` like Ruby allows, since it doesn't afford a *scalable* way of thinking (just imagine `<expression>` growing very large, and the "joy" of discovering a tiny `if` at the end, invalidating your initial assumption that reading the `<expression>` was relevant to your debugging). [Certainly](https://github.com/crystal-lang/crystal/wiki/FAQ#why-trailing-whileuntil-is-not-supported-unlike-ruby) no `<code_block> while <condition>`. The alignment between execution order and reading order was some of [Dijkstra's wisdom](http://www.dcs.gla.ac.uk/~pat/cpM/jchoco/nqueens/Goto-Harmful-Dijkstra.pdf): *"our intellectual powers to visualize processes evolving in time are relatively poorly developed, we should shorten the conceptual gap between the static program and the dynamic process, by spreading out the process in text space"*. In simpler terms: enabling the programmer to *trace the flow of execution* (aka. 'control-flow' or 'control') by simply reading the code. To be able to point to a precise location in the code/text, and ask what state the program/machine is in *at that time* (i.e. the [ostensibility](https://en.wikipedia.org/wiki/Ostension) of code). This is of course a feature of the [Von Neumann model of computing](https://en.wikipedia.org/wiki/Von_Neumann_programming_languages), so the language would to some extent be tied to it, but it would be a pragmatic choice, since it is the most prevalent model of computing anyway. Relatedly, it [is said](http://theory.stanford.edu/~aiken/other/backus.pdf) that: *"a core difficulty with \[Von Neumann style\] languages was that programmers were reduced to reasoning about a long sequence of small state changes to understand their programs, and that a much simpler and more compositional method of reasoning would be to think in terms of the net effect of a computation, where the only thing that mattered was the mapping from function inputs to function outputs."* I.e. imperative vs. declarative. So there might be some dissonance with functional programming model here, which the language should aim to resolve, since we desire both the *"reasoning about a long sequence of small state changes to understand their programs"* **and** the *"more compositional method of reasoning would be to think in terms of the net effect of a computation, where the only thing that mattered was the mapping from function inputs to function outputs"*. The programmer should be able to consider each, at both development and debugging, where each has its strength. NB: There are some arguments against paying any heed to control-flow at all (see: "4.2 Complexity caused by Control", [Out of the Tar Pit, 2006](http://curtclifton.net/papers/MoseleyMarks06a.pdf)), but unless we'd want an entirely lazy programming language, of which we are not (yet) convinced (cf. eager evaluation by default), then we're out of luck, as far as I know.
        
    * Reasonability and safety &gt; Power. "In other words, when I focus on reasonability, I don’t care what my language *will* let me do, I care more about what my language *won’t* let me do. I want a language that stops me doing stupid things by mistake. That is, if I had to choose between language A that didn’t allow nulls, or language B that had higher-kinded types but still allowed objects to be null easily, I would pick language A without hesitation." -- [Scott Wlaschin](https://fsharpforfunandprofit.com/posts/is-your-language-unreasonable/).
        
    * [Syntax matters (and homoiconicity is a plus)](https://youtu.be/5fG_lyNuEAw?t=965): Readability should not imply a one-to-one match with natural language (counter-inspired by [SQL](https://www.scattered-thoughts.net/writing/against-sql/#complexity-drag)), since natural language is inconsistent, duplicitous, ambivalent and multi-faceted. Consistency is key to a programming language. But it should borrow some of the sub-structures from commonly used natural languages such as English (like its popular Subject-Verb-Object, SVO, structure; see also the point on 'DFFP') to make adoption easier (more at-hand/intuitive) for most. Since such grammatical sub-structures are indicative of how we tend to model the world (maybe derived from our shared familiarily with physical objects acting on one another). (This can relate to [Chomsky's Universal Grammar theory](https://en.wikipedia.org/wiki/Universal_grammar) in linguistics). **The SVO syntax also aligns elegantly with the** [**Graph Data model of RDF**](https://www.w3.org/TR/rdf-concepts/#section-data-model) **(subject-predicate-object triples). So a language based on Subject-Verb-Object style could be** [**homoiconic**](https://wiki.c2.com/?HomoiconicLanguages)**, since subject-predicate-object is already a data structure (RDF).** Furthermore, if code-is-data (i.e. homoiconicity or pseudo-homoiconicity is preserved) it could be interesting to have **the code map well to a graph database**, opening up avenues for analysis in the form of [advanced graph algorithms](https://youtu.be/s3HvMvyHTUY?t=280), which could be useful for, say, code complexity analysis (e.g. more straightforward [cyclomatic complexity](https://en.wikipedia.org/wiki/Cyclomatic_complexity) analysis) or deadlock detection. There is already precedence in the use of [combinator graph reductions](https://en.wikipedia.org/wiki/Graph_reduction#Combinator_graph_reduction) in FP languages. Homoiconicity (code structure mirroring a data structure) could potentially also help with respect to typing, since we want to be able to execute the same code at compile-time (statics) and run-time (dynamics), to avoid [the biformity and inconsistency of static languages](https://hirrolot.github.io/posts/why-static-languages-suffer-from-complexity): ***"the ideal linguistic abstraction is both static and dynamic; however, it is still a single concept and not two logically similar concepts but with different interfaces"***. Counter-inspired by [JavaScript & TypeScript, which have plenty of duplicate abstractions](https://twitter.com/anuraghazru/status/1569377505462857734), for talking to either the runtime (JS) or the compiler (TS). **I want to simply talk once, and have the runtime and the compiler interpret what it needs**. *"One of the most fundamental features of Idris is that types and expressions are part of the same language – you use the same syntax for both."* -- Edwin Brady, the author of Idris (Edwin Brady, n.d.). Inspired by [Idris](https://hirrolot.github.io/posts/why-static-languages-suffer-from-complexity#idris-the-way-out). But, ["Idris, however, is not a simple language"](https://hirrolot.github.io/posts/why-static-languages-suffer-from-complexity#idris-the-way-out), so the ideal solution here is wanting... (but see the sub-point below) Maybe [patterns as types](https://www.reddit.com/r/ProgrammingLanguages/comments/cy009u/patterns_as_types/) could be a way... Or [types defined with the same language constructs](https://github.com/brillout/research/issues/1) as the runtime language, like in Zig's [comptime concept](https://ziglang.org/documentation/0.9.1/#Introducing-the-Compile-Time-Concept)... Data types are a way to *manually describe* the shape of data, but it seems what you want is to *automatically derive/infer* the shape of data (as far as you can, based on a closed-world assumption of your own code, where third party code would use [type bindings](https://rescript-lang.org/docs/manual/latest/external), and data received at runtime would need to fit into a type declared statically). In any case, the goal is to avoid duplication, avoid types being a declarative meta-language [on top of the language](https://hirrolot.github.io/posts/why-static-languages-suffer-from-complexity), and potentially allow constructing custom types imperatively (within some constraints, due to the Halting problem). This is also inspired by [NexusJS](https://nexusjs.org/) and [io-ts](https://gcanti.github.io/io-ts/), which allow the inverse, namely using types at runtime (for I/O validation): *"The advantage of using io-ts to define the runtime type is that we can validate the type at runtime, and we can also extract the corresponding static type, so we don’t have to define it twice."*
    * A potential solution to [the biformity and inconsistency of static languages](https://hirrolot.github.io/posts/why-static-languages-suffer-from-complexity) may be to avoid declaring types at all, but rather declare concrete data (mock data and/or default data), from which its type is inferred. This is expounded upon under the point on 'concretization'. This could also help with the homoiconicity problem that `code = data` doesn't play well with the presence of types. If we treat mock data as default data, and assign it as such (to variables, arguments, API calls etc.), we could run the program entirely without dynamic input, at the time of development or compilation, if we wanted to. Or, in production, we could have sane default/backup values to fallback to (without erroring) in case some third party API didn't provide us with all the data we wanted.
        
    * The syntax should as much as possible favor words over special characters (like curly braces, etc., and brackets and parentheses to a lesser extent). (This must be weighed against the desire for homoiconicity..). Plaintext words are *faster to write* (counter-intuitively enough, but learned from the shift towards password phrases over passwords with special characters, and from the benefit of not having to use modifier keys, which are esp. cumbersome on mobile keyboards), and more *aesthetical to read*, helpful [for visually impaired users](https://news.ycombinator.com/item?id=18414562), and more self-documenting to novices. Inspired by [Ruby](https://www.ruby-lang.org/en/) (`if .. end` is vertically more symmetric than a vertically aligned `if ... }`) and [Tailwind](https://tailwindcss.com/) (fast-to-type is a feature). The IDE should support auto-completion on language keywords (similar to how it can auto-complete references to your own code), so it's even faster to type the valid language keywords. The IDE should also allow toggling auto-compaction/tersification, for the times when you need to process a lot of information or many details of a a complex algorithm at once (though that should be a sign that you should refactor instead of writing more tersely). But the full text of language keywords should always be present, so people won't constantly need documentation to understand the gist of code that is shared online (otherwise you could get "what does `cons` and `conj` mean, now again?" scenarios). That should also ease on-boarding of novices, and thus benefit the growth of the ecosystem.
        
    * **Isolation / Encapsulation**. To analyze a program (i.e. break it down and understand it in detail), you need to be able to [understand parts of the program in isolation](https://youtu.be/Gv2I7qTux7g?t=632). So everything should be able to be encapsulated (all code, whether on back-end and front-end), since **encapsulation affords reasonability** (and testability), by limiting places bugs (i.e. errors in thinking) can hide. Counter-inspired by Rails views (sharing a global scope) and instance variables. Inspired by the testability of pure functions.
        
    * Params: We want to avoid [problems with ordering](https://youtu.be/rI8tNMsozo0?t=1571) and [mysterious arguments](https://www.codeproject.com/Articles/1186940/Lisps-Mysterious-Tuple-Problem). So, arguments to functions can be given in any order, but must always be named with labels corresponding to the parameters the function takes. If the label is equal to the argument variable name then the label can be omitted, since you shouldn't need to repeat yourself. (If the argument variable is referenced from a module, then the module path should be disregarded in the name matching.) Inspired by [keyword arguments](https://thoughtbot.com/upcase/videos/ruby-keyword-arguments) in Ruby and JS object params. Even if a function only takes only 1 parameter, then [it turns out it's useful/informational to have a label](https://github.com/lannonbr/vscode-js-annotations), unless the function takes a variable with the same name as it's parameter  (in which case the label should be omitted. E.g. you can write `output(message)` instead of needing to write `output(message: message)` which is repetition that frankly looks silly and represents noise. (In the SVO-syntax, the Subject can in principle be bound to any of the function's parameters that has the same data type, so to differentiate, the Subject also needs a label to designate which one. E.g.: `helloMom→message.joinWith(helloDad→secondMessageParam)`, where the keywords are put after the input data, due to 'DFFP'.) Counter-inspired by the [Mysterious Tuple Problem](https://www.codeproject.com/Articles/1186940/Lisps-Mysterious-Tuple-Problem) in Lisp, and inspired by the [labeled arguments](https://blog.dubenko.dev/typescript-vs-reason/) in ReasonML, and the [interleaving of keywords and arguments](https://en.wikipedia.org/wiki/Smalltalk#Messages) in Smalltalk.
        
    * No [currying](https://rescript-lang.org/blog/uncurried-mode). Inspired by ReScript. But should still allow specialization / partial application of functions by other means (see [the difference](https://stackoverflow.com/a/12846865)). Currying is related to how it is declared, whilst partial application is related to how it is used. [Currying](https://javascript.info/currying-partials) is dependent on parameter ordering when declared, but we want to allow any order of parameters (see section on "No Place-oriented programming" which talks about "parameter lists", and the section on "Params" which talks about "keyword arguments"). Partial function application is a common technique to be able to create new functions that are specialized versions of general functions that take many parameters. It allows providing the function with some arguments at one place in the code, but waiting until another place in the code to provide the rest of the needed arguments and then to execute it. Or supplying a function to code that expects to work with functions taking fewer parameters. We want to achieve such specialization by using closures rather than currying. Inspired [by](https://stackoverflow.com/questions/5091528/in-python-partial-function-application-currying-versus-explicit-function-defi) Python's `functools.partial` function, the application of which allows partial function application to be [decided upon at the place of use/application](https://forum.rescript-lang.org/t/uncurried-by-default/274/29) (not at the place of function declaration). Currying is also [typically](https://discourse.haskell.org/t/is-currying-worth-it/2853) tied to a strict and enforced ordering of arguments, which we [don't want](https://youtu.be/rI8tNMsozo0?t=1558) for flexibility reasons (see point on 'No Place-oriented programming'). Normal currying would also limit reuse: you shouldn't, at the time of declaration, have to predict which (or in what order) arguments will be available at at the time of use. Counter-inspired by Haskell. But if we were ever convinced to allow currying, then input params should at least be [explicit](https://forum.rescript-lang.org/t/uncurried-by-default/274/19) at every step (for [clarity](https://youtu.be/1AZA1zoP-II?t=2182), refactorability and to aid the compiler). Counter-inspired by argument/point free style in FP and [concatenative languages](https://news.ycombinator.com/item?id=31018833), due to the principle that [explicit is better than implicit](https://www.python.org/dev/peps/pep-0020/) (inspired by the Zen of Python). Should in any case probably [never auto-curry functions](https://forum.rescript-lang.org/t/uncurried-by-default/274/19), since it confuses partial function invocation with regular function invocation ("is the result of this function a function or a value?"), and [curried functions makes default, optional, and keyword parameters difficult to implement](https://news.ycombinator.com/item?id=28586862).
        
    * No [Place-oriented programming (PLOP)](https://youtu.be/YR5WdGrpoug?t=1213), iow. avoid order-dependence (aka. [positional semantics](https://ericnormand.me/article/clojure-and-types)) at almost any cost, since it isn't adaptable/scalable. Inspired by Clojure. Counter-inspired by [Haskell](ttps://ericnormand.me/article/clojure-and-types) and Elm, and [Lisp (and to some extent Clojure)](https://www.codeproject.com/Articles/1186940/Lisps-Mysterious-Tuple-Problem). This goes for [reorderability of expressions](https://youtu.be/6YbK8o9rZfI?t=3593) due to pure functions having **no side-effects**. Such reordering is desired (see: "4.2 Complexity caused by Control", [Out of the Tar Pit, 2006](http://curtclifton.net/papers/MoseleyMarks06a.pdf)) since it allows [designing](https://en.wikipedia.org/wiki/Top-down_and_bottom-up_design), structuring, and reading programs in a finish-to-start/high-to-low-level manner, enabling the reader to incrementally drill down into the code with the underlying implementation aka. "top-down program decomposition" aka. "call-before-declare" (the same [reason that JS has function hoisting](https://stackoverflow.com/a/59951418/380607)). Order-independence also goes for parameter lists to functions. I don't want to have to use a `_` placeholder for places where there *could* be a parameter, just because I didn't supply one. Shouldn't have to [sacrifice piping](%60%5B%60https://sporto.github.io/elm-patterns/basic/named-arguments.html%60%5D(https://sporto.github.io/elm-patterns/basic/named-arguments.html)%60) just to get named arguments, either (piping should use an [explicit pipe operator](%60%5B%60https://github.com/tc39/proposal-pipeline-operator/issues/84%60%5D(https://github.com/tc39/proposal-pipeline-operator/issues/84)%60)). Counter-inspired by Elm, and inspired by Hack. Consequence (?): would need a data structure like a [record](https://elm-lang.org/docs/records) but which ideally can be accessed in an order-independent manner (similar to a map). Plus, functions should be able to take in such records but also a`rest` parameter that can represent an arbitrary number of extra fields (to make functions more reusable and less coupled to their initial context, e.g. they should be able to be moved up/down in a component hierarchy without major changes to their parameter lists). Counter-inspired by Elm. But Records are useful for *enumerating what's possible*, and when used in pattern-matching the type system could warn you when you are forgetting to account for all fields, and show you where you need to update the code. This is esp. useful when refactoring, and esp. when working in a team. To achieve this benefit without resorting to Records and PLOP, the type system should *warn you* of the (pattern-matching) places you *could* want to update to handle all the Record's new fields, but you shouldn't be *required* to update them, if you don't want to. This way you, and the code, can stay flexible (and functions would be more reusable), but you'd also receive the needed guidance.
        
    * No `unless` or other counter-intuitive-prone operators. Counter-inspired by Ruby. See also the rationale for disallowing `<expression> if <condition>` as it also applies to `<expression> unless <condition>`. Even [Python's substitute for a ternary operator](https://medium.com/@chinesehuazhou/hello-readers-b6933bd109d1), `<expression> if <condition> else <expression>`, is prone to misuse. Such operators are a symptom of a deeper need. The lack of such operators could be alleviated with **'Dynamic code re-arrangement'** (see the point with same name in this article), since that allows you to focus on the chosen thing of importance when reading (e.g. the result, or the way you get to the result). In all, the reason such syntax is invented I think comes down to: **Some times you read code and just care about the result** (WHAT), and only once you've found the end results you care about tracing HOW it got there. Because why bother tracing long and intricate code if its result is ultimately not what you are after? While **other times you read code and want to go through all the steps chronologically to see what happens** (HOW), and the result is of secondary importance. Typically when debugging, or when you know you are looking in the right place in the first place. This points to the **need for tooling to be able to reorder code depending on what the programmer is looking for**. Maybe instead of treating code just as text characters, *code should be able to be treated as blocks* in the IDE, as many web based publishing platforms (Medium, Authorea, Hashnode) have discovered could be a smart and powerful thing to do with text.
        
    * No abstract mathematical jargon. Counter-inspired by Haskell. As it impedes onboardig, and induces a [mindset of theorizing](https://blog.plover.com/prog/haskell/what-goes-wrong-2.html) and [premature abstraction/generalization](https://blog.plover.com/2018/09/03/#what-goes-wrong) that impedes rapid development. Should be accessible for as wide a community as possible, with as little foreknowledge as possible. Inspired by [Quorum](https://quorumlanguage.com/). Also apply [some pragmatic constraints to conventions from functional programming](https://youtu.be/1AZA1zoP-II?t=2053) ways of writing code. In the interest of legibility and onboarding. FP conventions are not considered paramount (e.g. [currying](https://youtu.be/1AZA1zoP-II?t=2053), [argument/point free style](https://youtu.be/1AZA1zoP-II?t=2182) and [fold](https://youtu.be/1AZA1zoP-II?t=2242)), so they might not be supported, but their utility should be considered on a case-by-case basis. Inspired by Don Syme of F#. On the dislike of argument/point free style: *If you are to think about something, it is an advantage that it is there, in front of you, reminding you about what it is you are thinking about*. You should always be able to \*\**see* what you are working on. See later section on 'No need to manipulate data structures in the human mind'.
        
    * Do not presume contextual knowledge. In UX this is known as "[No modes!](https://www.pavley.com/2020/02/20/no-modes/)". Code should be able to be read from start to finish without having been educated/preloaded with any foreknowledge (like 'in this context, you have these things implicitly available'). Counter-inspired by class inheritance and Ruby magic, and JavaScript's [runtime bound](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this) `this` keyword and associated [scoping problems](https://kentcdodds.com/blog/classes-complexity-and-functional-programming) and [safety problems](https://youtu.be/PSGEjv3Tqo0?t=416). Turns out too much dynamism (runtime contextualisation) can be harmful. Counter-inspired by JavaScript: *"In JS,* `this` is one truly awful part. `this` is a dynamically scoped variable that takes on values depending on how the current function was invoked." -- [sinelaw](https://github.com/sinelaw/infernu).
        
    * Should facilitate and nudge programming in the language towards code with low [Cognitive Complexity](https://www.sonarsource.com/docs/CognitiveComplexity.pdf) score.
        
    * **Dynamic Verbosity**: Should be able to show more/less of syntax terms in the code (length of variable names could be auto-shortened). Beginners will want more self-documenting code. Whereas experts typically desire terser code, so they can focus on the problem domain without clutter from the language (e.g. mathematics). *"By relieving the brain of all unnecessary work, a good notation sets it free to concentrate on more advanced problems, and in effect increases the mental power of the race."* -- A.N. Whitehead (cited in [Notation as a Tool of Thought](https://www.eecg.utoronto.ca/~jzhu/csc326/readings/iverson.pdf)). A programmer will typically gradually go from beginner to expert on a code-base, even his own. See: content-addressable code. Content-addressable code would afford dynamic verbosity, which is important because: *"A language should be designed in terms of an abstract syntax and it should have perhaps, several forms of concrete syntax: one which is easy to write and maybe quite abbreviated; another which is good to look at and maybe quite fancy... and another, which is easy to make computers manipulate... all should be based on the same abstract syntax... the abstract syntax is what the theoreticians will use and one or more of the concrete syntaxes is what the practitioners will use."* -- [John McCarthy, creator of Lisp](https://www.infoq.com/interviews/Steele-Interviews-John-McCarthy/). Content-addressable code is also important for Dynamic Verbosity because of [Stroustrup's Rule](https://www.thefeedbackloop.xyz/stroustrups-rule-and-layering-over-time/): *"For new features, people insist on LOUD explicit syntax. For established features, people want terse notation."* -- Bjarne Stroustrup. *"When designing Rust, we quickly learned that the idea of picking short names to satisfy experienced users at the cost of new ones doesn't work in practice. Too many users complain that the language is too hard to learn and ugly; it took years for 'Rust is so ugly, it's the resurrection of Perl' to finally stop being a meme. If we had stuck to our guns with short keywords, Rust might have been dead by now. ... history has shown that readable languages much more frequently go on to be successful than languages with idiosyncratic syntactic choices."* -- [Patrick Walton](https://news.ycombinator.com/item?id=16011111) (on unfamiliar syntax in Lisp such as `car` and `cdr` vs. `first` and `rest`).
        
    * **Dynamic code re-arrangement**: code should be able to be re-arranged in order of start-to-finish/low-to-high-level or finish-to-start/high-to-low-level, because each is beneficial at various points when writing/reading code. Some times you care only about the results, and some times you care about how the program got to those results. But today, code is fixed in the order it is written. Typically in either an imperative way, displaying steps chronologically from start-to-finish, akin to chaining e.g. `data.func1.func2.func3`, or in a functional way: from outside-in, e.g.: `func3(func2(func1(data)))`, but when reading to understand the order of execution you have to read from the innermost to the outermost expression. This is problematic, at various times, and has arguably [made functional programming less accessible](https://probablydance.com/2016/02/27/functional-programming-is-not-popular-because-it-is-weird/) to newcomers. But both ways of reading are desirable, at different times: At one time you just care about viewing the overall result/conclusion (e.g. `func3` and what it returns), and potentially working your way backwards/inwards a little bit. Maybe you start with an end goal in mind (name of a function), and then drill down to a more and more concrete implementation. But at another time you care about going the other way around: seeing how it is executed from start to the finishing result/conclusion (think: piping). This duality of thinking/reading mirrors how we approach reading in other domains. This feature could be enabled by content-addressable code, since the arrangement of code itself could be made more malleable and dynamic. See: content-addressable code.


* Piping, or some form of it. But always top-to-bottom or left-to-right. Inspired by Bash, and functional programming with pipes (Elixir, BuckleScript, and [ts-belt](https://mobily.github.io/ts-belt/)). [Data-first instead of data-last](https://www.javierchavarri.com/data-first-and-data-last-a-comparison/).
    
* Not indentation based / whitespace should not be significant (counter-inspired by Python), since it is brittle: copy/paste bugs when the source and destination are indented differently, variable renaming resulting in bugs ([and more](https://yinwang0.wordpress.com/2011/05/08/layout/)). Sharing code online or by email can also [fail](https://www.ruby-forum.com/t/why-not-adopt-python-style-indentation-for-ruby/104458) when indentation is made meaningful, due to various editors treating indentation differently, some even stripping it out entirely (which would make code interpretation ambiguous). Whitespace should not implicitly determine the meaning of the program, rather: explicit meaning should determine indentation (which enables auto-formatting). Inspired by [Pyret](https://www.pyret.org/index.html), and Golang's auto-formatter [gofmt](https://go.dev/blog/gofmt). This also eases mechanical source transformations (with clearer git diffs) which eases maintenance on large code bases (i.e. scales better). It should also go without saying that invisible characters (whitespace; space, tabs) should not affect the meaning or interpretation of a program (Who would like to debug something they can't see? I once spent 2 days debugging a fragile API call which turned out to be due to an extra whitespace at some point in the XML message...). With explicit closing tags, the IDE can then help to re-indent code appropriately (since seemingly improper indentation couldn't incidentally carry semantic meaning). But the language should also **not require semicolons**. Inspired by Ruby, and semi-colon-free JS. Even though newline characters could be deemed to be significant whitespace, and subject to the aforementioned problems, it should only be a problem if the language is based around statements, not expressions (like intended).
    
    * BUT: Might consider allowing (though never requiring) indentation-based syntax, if the language has a standard style and formatter, and if the readability and ergonomics turn out to be vastly superior at scale, with the particular language syntax. In that case, tabs [should be forbidden](https://www.ruby-forum.com/t/why-not-adopt-python-style-indentation-for-ruby/104458/5) in favor of simple whitespace (IDE's can easily turn tabs into whitespace characters anyway).
        
    * Similar-looking and non-interacting code-lines should be able to change place without breaking anything. Counter-inspired by not able to add comma to last line in JSON, not being able to reorder/extract from comma-separated multi-line variable declarations in JS, and also counter-inspired by the contextualised expression terminators in Erlang.
        
    * Consistent syntax, optimized for code refactoring: "The language syntax facilitates code reuse by making it easy to move code from local block → local function → global function". Inspired by [Jai](https://github.com/BSVino/JaiPrimer/blob/master/JaiPrimer.md#brief-description).
        
* [**Data First**](https://www.javierchavarri.com/data-first-and-data-last-a-comparison/) **Functional Programming (DFFP)**. Based on the solid theoretical foundation of [**Lambda calculus**](https://learnxinyminutes.com/docs/lambda-calculus/). Should mimic the style of object-orientation, but is simply structs and functions under-the-hood. (Also: functional programming patterns over procedural code.) Because it is human to see and visualize the world ([as well as computing](https://cacm.acm.org/blogs/blog-cacm/248985-dijkstra-was-wrong-about-radical-novelty-metaphors-in-cs-education/fulltext)) in terms of objects and verbs, and to use verbs to signify the [causal relations between objects](https://www.researchgate.net/publication/330791815_Identifying_Embodied_Metaphors_for_Computing_Education). Focusing to heavily on only one of the paradigms (OOP or FP) can typically lead to anti-patterns (God classes/objects, Factory objects, and Singletons, in OOP), or program structures far removed from the business domain model which also has linguistically unintuitive syntax, as in FP (c.f. [FP is not popular because it is backwards](https://probablydance.com/2016/02/27/functional-programming-is-not-popular-because-it-is-weird/)). This is since only 12% of natural languages start with the verb, either Verb-Subject-Object (VSO) or Verb-Object-Subject (VOS), [subject-verb-object (wiki)](https://en.wikipedia.org/wiki/Subject%E2%80%93verb%E2%80%93object)), as FP tends to do, e.g. `verb(subject object)` or `verb(object)` or `(verb object)`. But 88% of natural languages start with something concrete, the Subject/Object (and the Object of one sentence is typically the Subject of the next sentence; similar to call chains). So [Subject-Verb-Object](https://en.wikipedia.org/wiki/Subject%E2%80%93verb%E2%80%93object) (SVO) should be preferred. The programming language could account for this, for instance like: `subject.verb(object)` or `subject.verb(subject.verb(object)).verb` or `subject.verb.verb` or `subject.verb(object).verb(object)` etc. (see 'syntax matters' on 'homoiconicity'). Because it enables the programmer to cognitively carry forward (dare I say.. iteratively mutate) a mental model, step by step (without relying on short or long term memory, which should be freed for higher level concerns than mere parsing). Inspired by method chaining and [Fluent interfaces aka. Fluent API's](https://en.wikipedia.org/wiki/Fluent_interface). But without Fluent interfaces [associated problems](https://youtu.be/q_WgVR9xtBw?t=541) like mutation/impurity, [large and cancerous classes/objects](https://www.yegor256.com/2018/03/13/fluent-interfaces.html), and functions coupled with (and inside of) those classes, so they would be hard to reuse across classes, or relocate across modules. Instead, since the Fluent API would be solved with a simple transform to Lisp/Clojure-style FP underneath (and IDE autocomplete would be done by looking up functions applicable to the resulting data type), we could respect [the open-closed principle](https://en.wikipedia.org/wiki/Open%E2%80%93closed_principle) and extend the functionality of a data type by simply writing new functions (wherever we want) that take in that data type. This is enabled by the `subject.verb(object)` to `(verb subject object)` transform, since the latter is simply a Lisp/Clojure style function (in JS terms it would be `verb(subject, object)`). The programmer would not have to mentally do this transform while coding and when looking at function definitions, because functions would also be defined in the same pattern, f.ex.: `subject.verb(object).defined_as(...)`. I think the SVO alignment is one significant but under-appreciated reason for OOP's success (since it affords [syntonicity](https://t.co/u0EFh15eg7), both of the body and ego kind). That, together with enabling a stepwise/imperative construction of programs (as Imperative programming styles capitalize on), makes for a more intuitive approach for beginners, which is vitally important for onboarding & growth. "Objects and methods" could be merely syntax sugar for structs and functions (see: [interchangeability of method-style and procedure-call-style](https://youtu.be/QyJZzq0v7Z4?t=1343), or the [pipe first operator](https://rescript-lang.org/docs/manual/v8.0.0/pipe) in ReScript, which also illustrates *emulating object-oriented programming*), if one leaves out troublesome inheritance (which might be good, since composition &gt; inheritance). Inspired by Golang. The quote "Data, not behavior, is the more crucial part of programming." [is attributed](https://news.ycombinator.com/item?id=21562007) to [Linus Torvalds and Fred Brooks](https://medium.com/webdevops/data-structures-548cbea9c520). If data is the focus-point, the language should mirror that. Interestingly, in addition to the more intuitive API, data-first also [affords](https://www.javierchavarri.com/data-first-and-data-last-a-comparison/) better IDE integration, simpler compiler errors, and more accurate type inference. Inspired by ReScript.
    
    * If all the language allows you to pass around is functions, then you could possibly choose whether to execute the program (functions) eagerly or lazily. If the program executes eagerly, then it could reify/materialize the result of functions down to the lowest level (primitive values) as it goes along. It would be interesting and potentially very useful to have *functions all the way down*. Loosely inspired by [Unlambda](https://en.wikipedia.org/wiki/Unlambda). Since composing functions without materializing values enables some powerful programming constructs (such as 'Transducers'; see elsewhere in this article) and the programmer always has an option to intercede and return a different value from a basic function used throughout the program, if need be.
        
    * Containability and explicitness. Inspired by **pure functions**. Perhaps the language should even restrict a function's scope only to what's sent in through its parameters. So no one can reference [hidden inputs](http://blog.jenkster.com/2015/12/what-is-functional-programming.html) (i.e. side-causes). Thus enforcing more predictable functions, where it is always apparent where it is used: what the function takes in and what it returns. So to achieve partial application of functions (i.e. useful closures), without addressing the outer scope implicitly, could be to supply variables from the outer scope as explicit default/preset/front-loaded parameters (e.g. in pseudo-JS: `let closureState = 2; function someFunction(a, b: closureState){...}`). This both makes the input and the closure more explicit, and [explicit is better than implicit](https://www.python.org/dev/peps/pep-0020/) (inspired by the Zen of Python). That way, input coming from closures (usually considered side-causes) would be declared in the function signature, so you don't have to dive into the (potentially long) function body to discover them. With the added benefit that a function could always be customized by the caller by overriding the closure values given as inputs by default (e.g. called as `let customState = 3; someFunction(a:1, b: customState);`). But importantly, the supplied custom variables should not be able to be shared with other functions (aka. global variables) unless they are full constants, because that would create the dreaded [shared mutable state](https://youtu.be/PNx9WqQ9QeA?t=90) which would introduce side-effects. If we should allow stateful functions at all, then we (at least here) favor functions being able to mutate (local, but persistent) state, rather than allow functions being able to share state with each other (e.g. via global variables). But we do prefer functions that always return the same result even when called repeatedly (i.e. idempotent, but [also](https://stackoverflow.com/a/4801291/380607) **without side-effects** i.e. being a pure function).
        
    * **Composable.** Favour composition over inheritance. Inspired by Robert C. Martin, Martin Fowler, and [JSX in React](https://reactjs.org/docs/composition-vs-inheritance.html). Composability entails it should be easy to write code that is *declarative*, *isolated* and *order-independent*. See "strongly typed".
        
    * Functional programming patterns like `.map`, `.filter`, over procedural code like `for-loops` etc., since the latter would encourage mutating state, and we want immutability.
        
    * [Immutability enables composability](https://youtu.be/6YbK8o9rZfI?t=3563), because it enables order-independence through managed effects.
        
    * [Referentially transparent expressions](https://medium.com/@olxc/referential-transparency-93352c2dd713). Which means variables cannot be reassigned, so a name will always refer to the same value (see principle: "Things that are different should look different"). Inspired by Haskell. Counter-inspired by Ruby: *"Of course, functional programming is possible in Ruby, but it's not the natural style. You often end up with many side effects, partly because it's the same syntax for value declaration and variable mutation."* [according to Laurent Le-Brun](http://www.fpish.net/topic/None/58676#comment-68530). Referential transparency should enable [a high degree of modularization](https://sookocheff.com/post/fp/why-functional-programming/) but *could* also lead to easy automatic parallelization and memoization.
        
    * [Automatic TCO (tail-call optimization)](https://stackoverflow.com/a/310980/380607). To keep the processing lean, and avoid potential stack overflow, by avoiding allocating new stack frames for recursive function calls. Counter-inspired by [Clojure / JVM](https://stackoverflow.com/q/10212928/380607). Inspired by [Scheme and ML-languages](https://en.wikipedia.org/wiki/Tail_call#Description), and [Lua](https://www.lua.org/manual/5.3/manual.html#3.4.10). TCO should align well with the desire to have a language where the programmer can have and mutate a mental model to carry forward, without either the programmer or the computer having to rely on remembering and returning to previously remembered values.
        
    * [Formally verifiable](https://youtu.be/yiiDFRs62lQ?t=1290) / [mathematically provable](https://en.wikipedia.org/wiki/Formal_verification). Nice-to-have, not must-have. The functional programming aspect of the language would support this. Provability of algorithms written in the language could reduce the need for specifying test cases for various forms of input. See also "Safety & Correctness".
        
* **Very constrained.** Since *"constraints liberate, liberties constrain"*, as [Bjarnason said](https://www.youtube.com/watch?v=GqmsQeSzMdw). Inspired by Golang's minimalism, [Austral](https://github.com/austral/austral)'s anti-features, and Elm's guardrails. For learnability and maintainability. Since [discipline doesn't scale](https://www.sicpers.info/2020/10/discipline-doesnt-scale/) ([obligatory xkcd](https://xkcd.com/292/): with too much power, and the wrong nudges, all it takes is a moment of laziness/crunch-time to corrupt a strong foundation), and a complex language affords [nerd-sniping](https://xkcd.com/356/) kinds of [puzzles](https://news.ycombinator.com/item?id=17905267), and [bikeshedding and idiomatic analysis-paralysis](https://news.ycombinator.com/item?id=17905222). Counter-inspired by Haskell. The virtue of functional programming is that it [subtracts features that are too-powerful/footguns](https://youtu.be/6YbK8o9rZfI?t=3315) ([compared to OOP](https://youtu.be/1AZA1zoP-II?t=2345)), namely: shared mutable state & side-effects. The language designers should take care of and standardize all the idiomacy (natural modes of expression in the language). *"Inside every big ugly language there is a small beautiful language trying to come out."* -- [sinelaw](https://github.com/sinelaw/infernu). The language should assume the developer is an *unexperienced,* [*lazy*](https://youtu.be/Gv2I7qTux7g?t=1337)*, (immediately) forgetful, and habitual* creature. As long as software development is done by mere humans. This assumption sets the bar (the worst case), and is a good principle for DX, as well as UX. The constrained nature of the language should allow for quick learning and proficiency. Complexity should lie in the system and domain, not the language. When the language restricts what *can* be done, it's easier to understand what *was* done (a smaller space of possibilities reduces ambiguity and increases predictability, which gives speed for everyone, at a small initial learning cost). The language should avoid [Pit of Despair programming](https://ericlippert.com/2007/08/14/c-and-the-pit-of-despair/), and leave the programmer in the Pit of Success: where its rules encourage you to write correct code in the first place. Inspired by [Eric Lippert](https://ericlippert.com/2007/08/14/c-and-the-pit-of-despair/) (of C#), but also by Rust.
    
    * Few keywords and operators: **I don’t want to talk to / instruct the compiler. I want the compiler to understand how I write my program. Even if that limits the ways in which I can write my program.** Counter-inspired by [F#](https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/symbol-and-operator-reference/), C# and Java. Inspired by [Clojure](https://www.tutorialspoint.com/clojure/clojure_operators.htm)'s extreme frugality with syntax (macros aside). Since every keyword and operator has to be implemented by the language, and potentially has to be learned by the reader. I'd rather want just functions with self-explaining and easily distinguishable names. (Inspired by Clojure, but also counter-inspired by Clojure's [cons](https://clojuredocs.org/clojure.core/cons) and [conj](https://clojuredocs.org/clojure.core/conj).) Even if the names may be longer to write. If it prevents a documentation lookup and reduces the size of the [meta-language](https://youtu.be/18F5v1diO_A?t=204), then it's worth typing a few extra characters (instead of `cons` maybe name it `construct` or even `build`). Code is read 10x more than it's written. You could argue learning a new keyword is a one time front loading cost that is amortized over the number of times it's later encountered (and saves writing and reading time by being terse). But a language should not be reserved for the few who are "in the know" (e.g. a [sociolect](https://en.wikipedia.org/wiki/Sociolect)), but be as accessible to everyone as possible. Also, even if certain keywords are encountered seldomly, if there are a multitude of them, every reader is bound to have to reach for the docs for *some* new keyword frequently enough, when reading code/projects written by others. A programmer's memory is better spent elsewhere.
        
    * Declarative over imperative ([data-oriented](https://en.wikipedia.org/wiki/Dataflow_programming) not capability-oriented syntax): The syntax of programming languages are typically based on the notion that you either _directly reference_ hardware-related constructs (memory regions etc., think C or Rust), or _give instructions to_ some language runtime, which then carry out those instructions (think Ruby or JS). Both of which means that the language invariably becomes closely coupled to either a certain conceptual model (i.e. capabilities) of the hardware that it needs to run on (or the limitations of [LLVM](https://en.wikipedia.org/wiki/LLVM), and its supported platforms), or needs to run on its own runtime. But what if you turned the language inside-out? So that the language does not envelop its runtime or platform, but is sufficiently abstracted (into describing only data, and dependencies between data) so that it can be consumed by any kind of runtime? Inspired by [XState](https://xstate.js.org/). That way people could implement various runtimes that have various sorts of capabilities/behaviors when it comes to executing the program code. Since the code does not presume anything about how the data is supposed to be processed (sync/async, eager/lazy etc.). Various runtimes may be tailored for different environments: local cpu-first, or distributed network-first, for example. Since some times synchronous operations are more performant, but other times async is unavoidable. Which means that the language syntax should not distinguish between sync/async operations, but leave the decision, of HOW the program is run, up to the runtime (where the responsibility should naturally be located: the runtime should decide the run time). Inspired by Golang's [elimination of the distinction between sync and async code](https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/). All this ties back to the aforementioned notion that **Programming needs to get away from the notion that the programmer is giving instructions to the machine.** *«Progress is possible only if we train ourselves to think about programs without thinking of them as pieces of executable code.»* -- Edsger Dijkstra. To *"separate the meaning of a program from the implementation details. ... Saying less about implementation should also make programs more flexible."* -- Paul Graham in [The Hundred-Year Language](http://www.paulgraham.com/hundred.html). So that the compiler or the runtime could choose the appropriate implementation details. See 'adaptive runtime'. (But doesn't it all come down to imperative machine instructions in the end? Yes, but the declarative foundation of the language could either be made in an imperative language like C, or there might exist a way to model even fundamental machine operations in terms of a declarative language, so the declarative language could bootstrap itself and be declarative all the way down...)
        
    * Names: No *alias names* for keywords in the language or for functions in the standard library (except for as documentation reference to other languages). Inspired by [Python](https://www.python.org/dev/peps/pep-0020/) ("explicit over implicit", "one way over multiple ways"). Counter-inspired by [Perl](http://www.wall.org/~larry/pm.html) (postmodern plurality) and *aliasing* in the [Ramda](https://github.com/ramda/ramda/issues/297) library. *All things tend toward disorder, as programmers it is our job to Fight Entropy (aka. chaos or variability).* The language should favor one consistent vocabulary, since it increases predictability and reduces variability. Even at the cost of expressiveness (the language should afford just enough expressiveness for the domain, see: configurable language, community grown). Names should not mimic any other programming language per se, but attempt to cater to complete beginners, because [notation has a large impact on novices](https://quorumlanguage.com/evidence.html), a principle inspired by [Quorum](https://quorumlanguage.com/). There should be a VS Code plugin that allows people coming from various languages to type function names as they know them and the editor will translate on the fly. E.g. typing in `array.filter` gets turned into `array.keep` in the code.
        
    * Guardrails: "`<insert your favorite programming paradigm here>` works extremely well if used correctly." as [Willy Schott said](https://medium.com/@willy.schott/one-can-say-the-same-about-fp-ca7b3944a32b). The ideal programming language should both **work extremely well even when used incorrectly** (which all powerful tools will be), but first and foremost **be extremely hard to use incorrectly**. Inspired by Rust and Elm.
        
    * Not overly terse. Counter-inspired by C. "Legibility trumps succinctness". Maybe give compiler warnings if the programmer writes names with less than about 4 characters. **Reading &gt;&gt;&gt; writing**, since time spent reading is well over 10x time spent writing (inspired by [Robert C. Martin](https://www.goodreads.com/quotes/835238-indeed-the-ratio-of-time-spent-reading-versus-writing-is)), and writing can be alleviated with auto-complete, [text macro expansions](https://www.trankynam.com/atext/), and [snippets](https://code.visualstudio.com/docs/editor/userdefinedsnippets), in the IDE.
        
    * No runtime reflection. Counter-inspired by meta-programming and runtime type inspection in Ruby.
        
    * Not overly verbose. Counter-inspired by XML and Java. Maybe compiler warnings if the programmer writes names with more than about 20 characters.
        
    * [The Rule of Least Power](%5Bhttps://www.w3.org/2001/tag/doc/leastPower.html%5D(https://www.w3.org/2001/tag/doc/leastPower.html)) (by WC3), suggest a language should be the least powerful language still suited for its purpose. To minimise its complexity and surface-area. For better reuse, but more importantly: to make programs, data, and (I will include) *data flows*, easier to analyse and predict. Inspired by [FSM](https://en.wikipedia.org/wiki/Finite-state_machine) & [XState](https://xstate.js.org/). It needs, however, to be just powerful enough to be generally useful (and [not limited to a DSL](https://youtu.be/mVVNJKv9esE?t=1046)). Possibly Turing-complete. Given these considerations, a Lisp-style language comes to mind. But there's reasons Lisp never became hugely popular. My guess: readability. So while it could be a Lisp-language (or compile to one), it should read better than one. *"If we were seeking power we would have stopped at GOTO's. ... The point is to* ***reduce our expressivity*** *in a principled way ... \[to\] something which is still powerful enough for our daily uses."* -- [Cheng Lou](https://youtu.be/mVVNJKv9esE?t=877) of ReScript.
        
    * See: Escape hatches.
        
* Pattern matching. Inspired by [Elixir](https://elixir-lang.org/getting-started/pattern-matching.html), [Rust](https://doc.rust-lang.org/book/ch18-03-pattern-syntax.html) and [ReScript](https://rescript-lang.org/docs/manual/latest/pattern-matching-destructuring). The expression-oriented nature of the language should make this natural, without extra/fancy syntax. Pattern matching could preferably [replace if/else](https://kyleshevlin.com/pattern-matching) conditional logic, perform totality checking to ensure you've covered every possible condition, and even enable conditional branching based on type.
    
* Niceties. Inspired by [Bagel](https://www.brandons.me/blog/the-bagel-language).
    
    * "Only single-quotes can be used for strings, and all strings are template strings and can be multiline ('Hello, ${firstName}!')"
        
    * No triple-equals; double-equals will work the way triple-equals does in JS.
        
    * Range operator for creating iterators of numbers (5..10, 0..arr.length, etc).
        
* Simple primitives, that compose well, so that you are able to make powerful abstractions. Inspired by [SolidJS](https://www.solidjs.com/), [Jotai](https://jotai.org/) and [Radix UI](https://github.com/radix-ui/primitives/blob/main/philosophy.md). But, their composability/orthogonality should be vetted and coherent before inclusion in the language, so not every programmer ends up in a tangle, and when programming you should be able to "foresee how your imaginary interface would fit with language semantics" (see [Rust is hard](https://hirrolot.github.io/posts/rust-is-hard-or-the-misery-of-mainstream-programming.html)). If this means fewer allowable primitives, so be it. Counter-inspired by [Rust](https://hirrolot.github.io/posts/rust-is-hard-or-the-misery-of-mainstream-programming.html#why-rust-is-so-hard). So, simple primitives instead of directly supplying powerful abstractions that you have to customize for various use cases, or wait for someone else to release an update for. Covered in the principle of [Composition over Configuration](https://maecapozzi.com/composition-vs-configuration/) (not to be confused with Convention over Configuration). *Maybe* [homoiconicity](https://wiki.c2.com/?HomoiconicLanguages)... since it would make writing the compiler slightly easier / more elegant, and make the language more readily available to evolve on its own (permissionlessly) in the community. Inspired by Lisp and Clojure's Rich Hickey. But homoiconicity would allow meta-programming, and the associated complexity..?
    
    * The language should maybe also [not be so powerful](https://blog.codinghorror.com/the-principle-of-least-power/) that programs become entirely composed by very high-level domain-specific abstractions, since it encourages esotericity and sociolects, but most importantly: code indirection when reading/browsing. Coding should not feel like designing an AST, so should try to encourage keeping the code flattened (by piping perhaps?) and as down-to-earth as possible. Could maybe be alleviated by an IDE plugin which would allow temporary automatic code inlining (editable previews).
        
    * *Removing variability in the syntax makes it more* [*targetable*](https://blog.codinghorror.com/the-principle-of-least-power/) *for* ***tooling*** *and static analysis.* This further benefits the **ecosystem**.
        
* [Transducers](https://medium.com/javascript-scene/transducers-efficient-data-processing-pipelines-in-javascript-7985330fe73d), under-the-hood, to compose and collate/reduce transformation functions (chains of map, filter etc. turn into a single function, [visualised here](https://web.archive.org/web/20190316032907/https://medium.com/@roman01la/understanding-transducers-in-javascript-3500d3bd9624)). Chaining function calls should use language-supported transducers implicitly. Maybe one could get [transducers for free](https://youtu.be/XkIoGmWkEpM?t=963) through use of [multiple return values](https://youtu.be/XkIoGmWkEpM?t=963), as inspired by Qi (a flow-oriented [DSL](https://en.wikipedia.org/wiki/Domain-specific_language) for Racket, the Lisp-like language). The language should at least not require a special `compose` syntax.
    
* No Exceptions. Inspired by Golang. But Recoverable and Unrecoverable errors. Inspired by Rust. (Definitely [no checked exceptions](http://literatejava.com/exceptions/checked-exceptions-javas-biggest-mistake/), as it breaks encapsulation by imposing behavior on the callee (the callee should only have to handle the function's specified result). Counter-inspired by Java). This has implications for tracing the control-flow of the program, and for how you write the program. See also: "Safety & Correctness".
    
    * Result data type, for error handling and validation. Inspired by Result from Rust and F#, and \[Either from Haskell\] ([https://blog.thomasheartman.com/posts/haskells-maybe-and-either-types](https://blog.thomasheartman.com/posts/haskells-maybe-and-either-types)) and Elm, although it should not be called Either, as [Either is a confusing misnomer](https://youtu.be/YR5WdGrpoug?t=623). See also: "Data types, type system".
        
* No null, and clear Error handling: Goal is to eliminate [timid coding patterns](https://youtu.be/T8J0j2xJFgQ?t=151) like null checks everywhere. Counter-inspired by Golang. No implicit `null` or `nil` value. Meaning no runtime null errors (typically occurring far removed from their point of inception). Inspired by Elm and Rust. Ideally without having to explicitly declare `Maybe` aka. `Option` types (inspired by Hickey's [Maybe Not](https://youtu.be/YR5WdGrpoug?t=623)). Could either automatically represent nilable variables as a union between the type and nil (think `String?`), so that the compiler can do null reference checks at compile-time. Inspired by [Crystal](https://crystal-lang.org/). Or, *automatically but statically* infer and create/augment a function's return type to a [nullable reference type](https://docs.microsoft.com/en-us/dotnet/csharp/nullable-references) indicated by a `?` after the typename, whenever there is an unhandled condition that could result in a null value. Or *automatically* create a `NullObject` (see: [NullObject pattern](https://youtu.be/OMPfEXIlTVE?t=904)) of the function's declared return type. Maybe even better: [let every type declare and handle their own empty state](https://twitter.com/magnemg/status/1417517013321273345?s=20). If all types are [defined in terms of Monoids](https://twitter.com/magnemg/status/1429914312211054602?s=20), then ***null* could be replaced by the identity value (of each Monoid)**, so that combinations within that type never fail, and never alter the result. NB: would make it hard to express something which was supposed to be there but which is missing, like a missing point on a graph curve, instead of plotting a definite 0. So would need careful consideration to choose this approach. There are [some benefits of Nullability](https://graphql.org/learn/best-practices/#nullability) as GraphQL has demonstrated, especially in a networked setting. But even then I'd prefer some standardized Error object (with a necessary error message) that the client would have to handle. Because otherwise, how do you know the reason for the failure? Did a service go down, so the resolved field was nulled out, or did did a programmer forget to implement something or was it a bug in the server code..? Maybe nullability will be considered for over-the-network responses, but operations on a machine should be treated as having a greater guarantee to complete, and thus the data type should have stricter rules. In all: “Non-nullability is the sort of thing you want baked into a type system from day one, not something you want to retrofit 12 years later” -- [Eric Lippert](https://web.archive.org/web/20161022020746/http://blog.coverity.com/2013/11/20/c-non-nullable-reference-types/#.WArKAMHP0ak) of C#.
    
    * Function indepencence: When a function [becomes](https://blog.jonstodle.com/in-which-i-claim-rich-hickey-is-wrong/) [more capable](https://medium.com/@thejameskyle/type-systems-covariance-contravariance-bivariance-and-invariance-explained-35f43d1110f8) (by widening its allowed input, e.g. `string` to `Option<string>`, or tightening its returned result, e.g. `Option<string>` to `string`) it shouldn't [break callers](https://www.reddit.com/r/haskell/comments/a1ofh2/maybe_not_rich_hickey/eawpz30/) (which then could result in cascading refactors, cf.: [what color is your function?](https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/)). A way to solve this would be if the language could automatically perform casting of such arguments/results, and have a type system that could account for that. Inspired by Flow, and counter-inspired by TS. Furthermore, the return type from functions using I/O (like `IOMonad` in Haskell), should always be augmented/inferred from static analysis.
        
    * *Variant Types* for error-handling using return values (like `Result<Type, Error>`, inspired by Rust), instead of special syntax. [Counter-inspired by Golang](https://qr.ae/pGPMUk).
        
    * So that [you have less avenues to explore when debugging](https://overreacted.io/the-bug-o-notation/) and [fewer branches to check when programming](https://lispcast.com/why-are-corner-cases-the-devil-%f0%9f%98%88/), so you can write [Confident Code](https://www.youtube.com/watch?v=T8J0j2xJFgQ) focused on the happy-path.
        
    * No possibility of failing silently during runtime (due to syntax errors). Counter-inspired by JS.
        
* No `@decorators`. Counter-inspired by Angular and NestJS. Decorators feel like “magic” that make the runtime control-flow unobvious. I don’t like macro-expansions, either. **I don’t want to talk to / instruct the compiler. I want the compiler to understand how I write my program. Even if that limits the ways in which I can write my program.** Rather than allowing a wide range of styles, and then having to decorate certain styles ad-hoc, to disambiguate them. I don’t like the aesthetics of decorators either.
    

## Execution model

* Eager evaluation by default ([strict](https://en.wikipedia.org/wiki/Evaluation_strategy#Strict_evaluation), [call-by-value](https://bambielli.com/til/2016-07-24-CBV-vs-CBN/)). Since it is more straightforward to reason about in most cases, simpler to analyze/monitor/debug, and spreads CPU and memory consumption out more in time, than [lazy evaluation](https://en.wikipedia.org/wiki/Lazy_evaluation) (aka. [call-by-need](https://en.wikipedia.org/wiki/Evaluation_strategy#Call_by_need), aka. memoized [call-by-name](https://bambielli.com/til/2016-07-24-CBV-vs-CBN/)) which would pile up work and in worst case could [overflow memory at an unexpected time](https://prog21.dadgum.com/40.html) (in any case, the programmer shouldn't have to worry about evaluation strategies, including [space usage performance and evaluation stack usage](http://pchiusano.blogspot.com/2011/12/future-of-programming.html)). Inspired by Idris. But it should use the generally more effective (do-less-work) lazy evaluation approach if currying functions, or chaining methods, unless intermediate error-handling or similar requires value realization aka. data materialization (and even here, transducers could potentially alleviate unnecessary value realization). Inspired by Lazy.js. But this is an optimisation that could wait. Concurrent operations across threads/processes should [not be lazy](https://softwareengineering.stackexchange.com/a/124502/104312). Since you'd want to start exercising the machine(s) as soon as possible. Counter-inspired by Haskell. Although it must be said: I am eager to be convinced that [lazy in general is better](http://www.cse.chalmers.se/~rjmh/Papers/whyfp.pdf) and that [space leakage](https://stackoverflow.com/a/28868806/380607) and the [bookkeeping overhead](https://softwareengineering.stackexchange.com/a/286063/104312) can be minimized. But in general, **the programmer shouldn't need to worry about *when* the machine executes some piece of code**. Why wouldn't it be possible for a compiler to figure out at compile-time how and where functions are referenced, and choose eager or lazy evaluation depending on which is more suitable? For sequentially [chaining of operations on data structures](https://danieltao.com/lazy.js/), it could be lazy, and for [other operations](https://stackoverflow.com/q/28868636/380607) (potentially further apart in the program, with potentially memory intensive operations in between..) it could choose to be eager (get the work done, so the memory can be free'd asap). Or?

* Async should be eager, but await should be lazy. Compared with JS. The machine should start async operations immediately, but you shouldn't have to denotate when to await it. It should be automatically awaited (block the process) only when the result is needed (i.e. lazy).
    
* **Async: blocking/sync interface, but non-blocking I/O**. Inspired by Golang, and to lesser extent JS / Node.js too. But should not have to litter code with async/await repeatedly (see: [what color is your function?](https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/) and [the problem with function annotations](http://pchiusano.blogspot.com/2009/05/optional-laziness-doesnt-quite-cut-it.html), and [async everything](http://joeduffyblog.com/2015/11/19/asynchronous-everything/), even though [async/await can help nudge developers towards a "functional core, imperative shell" architecture](https://betterways.dev/functional-core-imperative-shell)..). Could be solved with [Async Transparency](https://hyperscript.org/docs/#async), inspired by Hyperscript. But hiding the async nature with synchronous seeming abstractions could create a dangerous model-code gap with a potential impedance-mismatch and cause for design errors and bugs ([inspired by Simon Brown](https://youtu.be/5OjqD-ow8GE?t=2768))... So the language should make some abstractions around async simple (like goroutines in Golang). But also inspired by declarative and easily statically analysable async contexts, made with JSX, like Suspense (which is basically an async if-statement), in React and SolidJS.
    
    * Alternatively: Async everything? The feature [referential transparency](https://en.wikipedia.org/wiki/Referential_transparency), obtained if the language **enforces Pure Functions (i.e. no side-effects)**, could potentially [open up an avenue](https://stackoverflow.com/a/18499847/380607) for making everything async by default (and letting the compiler insert `await` instructions where it figures out functions are not I/O bound and thus can be optimized direct/synchronous CPU execution instead, without the overhead of asynchronicity).
        
    * **Ease of reasonability is first priority**. Inspired by F# ([Is your language reasonable?](https://fsharpforfunandprofit.com/posts/is-your-language-unreasonable/) by Scott Wlaschin). I believe it is best afforded by **simple and clear abstractions** (without model/code impedance mismatch, as made important by failures of ORM's and distributed contexts). The choice of sync interface here as opposed to async, is similar to how the wish for [lazy evaluation](https://en.wikipedia.org/wiki/Lazy_evaluation) by default was discarded for eager evaluation by default. One [argument by Ryan Dahl of Node.js](https://mappingthejourney.com/single-post/2017/08/31/episode-8-interview-with-ryan-dahl-creator-of-nodejs/) is that sync by default with explicit async (he mentiones goroutines in Go) is a nicer programming model than async everything (like in Node). Because it's easier to think through what the program is doing in one sequential control flow, than jumping into other function calls like in Node.js (if you are using async callbacks). See the "fragments your logic" point below. Reasonability is a top priority, so we cannot make a compromise here.
        
    * Async: Unbounded [Buffered Channels](https://golangr.com/channel-buffering/), which simply puts messages onto the queue/buffer of the channel (see also "Machines" concept under the "Scalable" feature). Inspired by Golang and [Clojure](https://clojure.org/news/2013/06/28/clojure-clore-async-channels). So that the sender can continue working without having to wait for the receiver to synchronize for sending the message (thus freeing CPU time at the expense of some memory). The channel buffer should ideally be unbounded, as it is hard to predict in advance an accurate buffer limit (and reaching the limit will also mean the end of concurrent operations). So the channel should not block the sender when it's writing to it, but it should block the reader when it's reading from an empty channel (until the channel receives a value). Inspired by [Alexey Soshin](https://qr.ae/pGdyji), and inspired by BlockingQueue in Java. Counter-inspired by Golang and [Clojure](https://clojure.org/news/2013/06/28/clojure-clore-async-channels). Maybe there should be some confluence of CSP and Actor model, since [each works best at different abstraction levels](https://news.ycombinator.com/item?id=16177983), and we ideally want [loosely coupled and flexible](https://news.ycombinator.com/item?id=25849806) mechanisms which are equivalent to backpressure (inspired by samuell from HN). Ideally, a receiver shouldn't need to [use backpressure](https://magne.medium.com/sorry-for-being-presumptuous-the-suggestion-was-well-intended-i-do-think-it-was-correct-though-240e47c0880f) to signal a desired reduction in messages, but simply control how fast it is reading from the buffered channel, since it should be in control of it's consumption anyway. The language should provide abstractions so that the user doesn't have to worry about these things, and then choose the appropriate model under-the-hood depending if it's running on one machine or distributed (see: 'Adaptive runtime'). This idea of 'abstracting away the network' should not be adopted lightly. Since programmers might make mistakes when important distinctions are hidden (i.e. using convenient Ruby chaining with the Rails ORM, can quickly lead to inefficiencies like excessive queries). We also have a principle *"Make similar things look similar, and different things look different"*. So unless the abstraction actually abstracts away all important differences, *and* the location (it's local/distributed nature) of the called service is apparent from the usage context (by conventions in naming or otherwise), such abstractions can be dangerous and should be avoided in favor of explicit primitives instead.
        
    * Good means of async control: Being able to cancel tasks/jobs, set timeouts, and easily be able to wait for a task to finish. Channels should be able to contain Tasks that return a Result (which may contain an error), and are cancellable.
        
        * [Rich Hickey has some good arguments against async by default](https://youtu.be/yJxFPoxqzWE?t=1831) (when implemented with callbacks as in JS), namely that it:
            
            * fragments your logic (spread out into handlers), instead of keeping it together. Programmer has to deal with multiple contexts at once (complicated), instead of one overarching context (simple).
                
            * callback handlers perform some action once in the future, but the state they are operating on may have mutated in the meanwhile. So it may give a false confidence in being able to get back to the state as it were when the callback was made. We want to avoid the dreaded [Shared Mutable State](https://youtu.be/PNx9WqQ9QeA?t=90). Which may be solved with only allowing immutable constructs (like Clojure).
                
        * On the other hand, having sync by default, and *async through* [*Channels*](https://tour.golang.org/concurrency/2):
            
            * gives the control back immediately (in line with functional composition) instead of functions that effectively evoke side-effects on the real world on the other end (as callback handlers do). In line with our principle: Always give control back to the programmer.
                
            * channels are generalized pieces of code that can handle many connections (pub/sub).
                
            * channels afford safe concurrency (thread handling), whilst with callback handlers (unless used in an event-loop system such as JS) the programmer has to ensure safe concurrency (which we [don't want](https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/)).
                
        * channels afford choice on when to handle an event, whereas with a callback it gets called whenever it gets called (event-loop). Channels work in line with our principle: Always give control back to the programmer.
            
    * All of the above have implications for reasonability. Needs to be investigated further... Golang's way of handling async seems to be [the current gold standard](https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/), touted by many bright people, since *"Golang has eliminated the distinction between synchronous and asynchronous code"* (by letting the programmer code everything in a sync fashion, but doing async I/O under the hood). Golang's principle of *"Don't communicate by sharing memory; share memory by communicating."* avoids the dreaded [Shared Mutable State](https://youtu.be/PNx9WqQ9QeA?t=90) and affords itself better to ensure **simple, safe, and scalable modes of thinking** (our core principle): It's hard to think of something, if it has changed the next time you think about it (thus: immutability). Or if thinking about it changes it (manifesting in code the cognitive equivalent of [Heisenbug](https://en.wikipedia.org/wiki/Heisenbug)'s): Programmers need to be able to reason about a program's state without simultaneously modifying that state ([inspired by CQRS](https://en.wikipedia.org/wiki/Command%E2%80%93query_separation#Connection_with_design_by_contract)).
        
    * Another, but more radical idea: **The programmer shouldn't have to think about *when* or *where* the code will run**. It should be managed by the language runtime, based on the specified platform. If the program is a local program for one machine then it could be specified to run the work *synchronously*. If run over multiple machines, it could be specified to use async by default, to delegate work. But then if results don't arrive within time (from a remote machine/CPU-core), it could chose to perform the work itself, but lazily when the result is needed. So there should be some built-in semi-lazy evaluation measure based on CPU monitoring. Also, for the work it decides to do itself, the runtime should decide when to perform it: if the CPU-cores are idle, then it should eagerly execute the work, but if not then it should postpone just enough work so that the CPUs are adequately exercised. Currently, in languages without this nuanced model, the programmer has to make an either-or distinction based on a generalized heuristic of whether or not async or lazy makes sense, and apply it in a fixed fashion. But these assumptions do not necessarily hold for operational scenarios. Ideally, the programmer shouldn't have to think about such operational, low-level matters.
        
* Ergonomic to type. Prefer text over special characters like curly brackets (they are hard to tell apart from parentheses in JS). No littering of parentheses. Inspired by Ruby. Counter-inspired by JavaScript, Lisp, and JSON.
    

# Safety & correctness

* Well-tested.
    
* Memory safe, ergonomic, and fast. should be safely and implicitly handled by the language, without a runtime GC.
    
* [No Garbage Collector](https://youtu.be/Gv2I7qTux7g?t=123) (GC), but also no garbage. Garbage is a problem that ought to be solved in a language's syntactical and semantical design (through shepherding the programmer's thoughts, and giving feedback at compile-time or even better: immediately at development-time). It could be solved by having Deterministic Object lifetimes, and Ownership tracking (affinity type system). Inspired by Rust and [Carp](https://github.com/carp-lang/Carp). Alternatively, the language could take [inspiration](https://evincarofautumn.blogspot.com/2012/02/why-concatenative-programming-matters.html) from [concatenative programming languages](https://dev.to/redbar0n/concatenative-programming-languages-e03) which doesn't generate garbage by design, has [other desirable properties](https://www.youtube.com/watch?v=_IgqJr8jG8M), and uses the stack heavily. Inspired by [Kitten](http://kittenlang.org). Garbage is a symptom of memorizing (keeping track of loose ends), which is tedious for the programmer, as well as the runtime (and potentially the compiler). Garbage comes when you have to clean up something you memorized (something you allocated memory for, but somehow stopped using further on). Concatenative programming is closely related to FP through [continuation-passing style](https://en.wikipedia.org/wiki/Continuation-passing_style) (CPS) and [tail-call optimization](https://stackoverflow.com/a/310980/380607) (TCO). The language/compiler should [utilize CPS](https://www.defmacro.org/2006/06/19/fp.html) where possible, so as to reduce/optimize usage of the stack. It should be able to [store a continuation](https://www.defmacro.org/2006/06/19/fp.html) (equivalent to persisting the stack to RAM/Disk) so that stateless programs (like a web server) could be restarted near a point of interruption/error (when the client makes the request again), to simulate statefulness. Inspired by Scheme.
    
* Memory-management & safety. The language should be low-level enough that it enables creation of various memory management strategies, and afford systems-level control of hardware resources: pointers to memory addresses (for mutation purposes), memory allocators, etc. Inspired by C and Rust. But each Platform (see 'Configurable language') should have a general and default memory management strategy, so that application code written for a given platform can avoid explicitly managing memory. Some variations within the general memory management strategy should be configurable for each Platform. A 'Platform' should specify an implementation of the memory management strategy. Inspired by [Roc](https://youtu.be/cpQwtwVKAfU?t=1574). It should for example enable choosing [Arena-allocation](https://youtu.be/cpQwtwVKAfU?t=1436) strategy for HTTP request-response cycles, which would be optimal there. This type of performance enhancing platform config ties back into the point 'Configurable language' (elsewhere in this article). The language could have *Automatic Reference Counting*, but with optimized throughput by Static Reference Counting to perform [reference couting during compile time](https://github.com/matthieu-m/static-rc) while also canceling out redundant reference checks ([update coalescing](https://en.wikipedia.org/wiki/Reference_counting#Dealing_with_inefficiency_of_updates)). Inspired by [Roc](https://youtu.be/vzfy4EKwG_Y?t=355). Or maybe a Borrow Checker, for memory-safety. Inspired by Rust. But ideally, [Ownership and Borrowing](https://blog.logrocket.com/introducing-the-rust-borrow-checker/) should be implicitly handled by the programming language, so the programmer wouldn't have to think about low-level concerns such as memory management (e.g. what goes on [the stack vs. the heap](https://doc.rust-lang.org/book/ch04-01-what-is-ownership.html#the-stack-and-the-heap)) or various kinds of references. Inspired by [smaller Rust](https://without.boats/blog/notes-on-a-smaller-rust/). To avoid conceptual overhead of manual memory management (as with explicit borrowing semantics), the language should perhaps use or take inspiration from [Koka's Perceus Optimized Reference Counting](https://koka-lang.github.io/koka/doc/book.html#why-perceus). Koka apparently allows even more [precise reference counting (see sect: 2.2)](https://www.microsoft.com/en-us/research/publication/perceus-garbage-free-reference-counting-with-reuse/) than Rust. Inspired by [Koka](https://koka-lang.github.io/). An idea that might be worth exploring is to use [Arena allocation](https://youtu.be/cpQwtwVKAfU?t=1436) (aka. [Region-based memory management](https://en.wikipedia.org/wiki/Region-based_memory_management)) as the default memory management strategy for the language, since it has the lowest overhead possible. Coupled with [stack based semantics](https://en.wikipedia.org/wiki/Stack-oriented_programming) and potentially also [linear types](https://en.wikipedia.org/wiki/Substructural_type_system#Linear_type_systems) it could make for a very efficient language.
    
* Secure from the start. Secure runtime. Inspired by Deno. Safety has to be a built-in design-goal from the start, it cannot be added on later. As evidenced by the justification of existence of Deno (Node was unsafe), and Rust (C++ was unsafe). Also, see: memory safe.
    
* Crash-safe. Can crash at any time and resume computation at exact same spot when restarted. Inspired by Erlang.
    

## Data types, type system

* Gradually typed, as types can add boilerplate, create [unnecessary](https://github.com/BSVino/JaiPrimer/blob/master/JaiPrimer.md#the-philosophy-of-jai) [friction](https://michaelfeathers.silvrback.com/the-ergonomics-of-type-checking), obstruct a programmer's [tinkering](https://github.com/staltz/ama/issues/49) [flow-state](https://en.wikipedia.org/wiki/Flow_(psychology)), and create noise in the code. Counter-inspired by TypeScript, and inspired by Elm and [Jai](https://github.com/BSVino/JaiPrimer/blob/master/JaiPrimer.md). As many types as possible should be inferred. Inspired by TypeScript but even more inspired by OCaml and ReScript.
  * Development speed vs. Robustness: When prototyping you don't want to worry about robustness that much. You want to develop as fast as possible, and just want to see if your assumptions hold under some particular circumstance (not every possible ones), and if the program crashes that's not too consequential. In production, robustness and handling of all edge cases obviously becomes more important.
  * Compiling for a Platform (a distributed system, for example), should give compiler errors if robustness is not ensured (static types, async processing, error handling, possible loading states, how to deal with missing/null values from third party API's: accept or reject the request, partly or in full etc.). Whereas compiling for a local Platform (single-machine) some of [the errors/concerns with a distributed system](https://youtu.be/Srt_8a5Nam0?t=305) can be exempt: can assume assume calls return a response syncronously and only once (the [fallacies of distributetd computing](https://en.wikipedia.org/wiki/Fallacies_of_distributed_computing), idempotency, overhead of serializing data, potentially independent API versions, etc. don't need to be accounted for to the same degree). Therefore, a lot of the developer's work can be alleviated, and the compiler can be less strict, to allow for greater development speed. If compiling the program for a distributed Platform, then the developer would only then need to account for the compiler errors that ensure that the program will be robust in such a setting.
    
* No runtime type errors. Inspired by Elm (and Haskell). See 'Error Handling & Non-Nullability'.
    
* Union Types: Types should be associative/commutative/composable/symmetric (i.e. `A|B` should equal `B|A`), inspired by Dotty/Scala3, and the ['Maybe Not' talk by Rich Hickey](https://youtu.be/YR5WdGrpoug?t=623).
    
* Types should be enforced statically at program exit boundaries (so external libraries or outgoing I/O are ensured existing typings).
    
* [Structural subtyping](https://www.typescriptlang.org/docs/handbook/type-compatibility.html) (inspired by TypeScript, OCaml), instead of nominally typed (counter-inspired by [Java](https://www.youtube.com/watch?v=aSEQfqNYNAc) and [Haskell](https://lexi-lambda.github.io/blog/2020/01/19/no-dynamic-type-systems-are-not-inherently-more-open/#footnote-ref-2-1)). Since it is the closest you'll get to duck-typing within a statically typed language. But it should also have support for nominal types at the few cases where that might be beneficial (i.e. opaque types, not possible with only structural subtyping). Inspired by [ReScript](https://www.greyblake.com/blog/from-typescript-to-rescript/), and counter-inspired by TypeScript.
    
* [Strongly typed](https://rescript-lang.org/docs/manual/latest/type) (checked at compile time), not weakly typed, since implicit type coercion (at runtime) can be unpredictable, and variables that can potentially change their type at runtime is [madness](https://www.destroyallsoftware.com/talks/wat). Inspired by TypeScript and ReScript. Counter-inspired by JavaScript.
    
* [No runtime polymorphism](https://baturin.org/blog/introduction-to-ocaml-part-4-higher-order-functions-parametric-polymorphism-and-algebraic-data-types/) (aka. 'ad-hoc polymorphism', 'dynamic dispatch' or 'monkey-patching'). Counter-inspired by Python, Ruby and JavaScript. Also, even compile-time function/operator overloading should NOT be possible. E.g. `+` can't be used both to sum integers and join strings, so you'd have to use more operators like `++` or similar to join strings; [explicit is bettter than implicit](https://www.python.org/dev/peps/pep-0020/), and even better than ambiguous/context-sensitive. Without these features we'd gain the more important ability to fully infer static types for programs, without having to write type annotations, and compiling could get really really fast. Inspired by OCaml (and by extension also ReScript). Counter-inspired by Clojure, Java, Ruby.
    
* [Generics / Type parameters / Parametric polymorphism](https://rescript-lang.org/docs/manual/latest/type#type-parameter-aka-generic). Inspired by ReScript and OCaml. Counter-inspired by how C++ and Java [handles generics](https://research.swtch.com/generic). Basically, to make generics sane, coherent, and pragmatic, without nudging developers into going too much overboard with generic abstractions (like [generics induced function coloring](https://news.ycombinator.com/item?id=29735509)). So maybe some kind of limitations to generics, like Rust. Since I'd [prefer a little duplication](https://sandimetz.com/blog/2016/1/20/the-wrong-abstraction) instead of a complex abstraction. Due to reason-ability, time to onboard new developers to a project, and the roughly 10x more time programmers spend reading than writing code, as [the saying](https://www.goodreads.com/quotes/835238-indeed-the-ratio-of-time-spent-reading-versus-writing-is) goes.
    
* Type inference, sound and [fully decidable](https://3fx.ch/typing-is-hard.html#decidability) and with 100% coverage. Inspired by OCaml and [Roc](https://youtu.be/6qzWm_eoUXM?t=762). To not have to declare types everywhere. For increased readability and convenience (though not essential, cf. popularity of Rust). But local type inference inside the body of functions are what's most important (inspired by Scala), since functions input/output types should always be declared, for documentation purposes. But they could probably be generated after the prototyping phase / exploratory coding is done and you want to ossify the code. In that case, they should not be inline (like in TS), but next to the function definition (like in Elm).
    
* Pragmatic type bindings for external libraries: should allow you to write type bindings that mirror how you will use the library in your own project, instead of getting stuck at generalizing potentially complex types. Inspired by [ReScript](https://forum.rescript-lang.org/t/possible-to-import-typescript-packages-into-reason/989/5).
    
* [Typed Holes / Meta Variables](https://jfdm.github.io/post/2020-07-09-Programming-with-holes.html). Inspired by Idris. Since it "allows computing with incomplete programs", and "allow us to inspect the local typing context from where the hole was placed. This allows us to see what information is directly available when looking to fill the hole". I.e. the compiler provides hints about its attempt to infer the type of the missing value (aka. hole). As opposed to either requiring that a program is fully typed, it can afford a [Live programming environment](https://www.youtube.com/watch?v=q58NFuUr0GU) that give feedback to the programmer while editing about how it would be executed.
    
* No type classes or highly abstract type level programming. (See also 'First-class modules', since type classes are [considered incompatible](https://www.reddit.com/r/haskell/comments/4smzl1/firstclass_modules_and_type_classes/) with that feature. See also no 'ad-hoc polymorphism'.) When your [type system becomes Turing-complete](https://twitter.com/flybayer/status/1565061070363959297) and you [start programming in the type system](https://twitter.com/teemu_taskula/status/1413919990739316740) (aka. [wrangling type-level prolog](https://amulet.works/)), or even [unit testing the type system](https://twitter.com/mattpocockuk/status/1646452575665893377)(!), then I consider it a language design smell. See [statics-dynamics biformity](https://twitter.com/magnemg/status/1572507217567584263) and ["types are a (distracting) puzzle"](https://news.ycombinator.com/item?id=17905267) for why. 
  * A [potential way(?)](https://x.com/magnemg/status/1729917963489165783?s=20) out of the statics-dynamics biformity could perhaps be to declare data types in terms of concrete mock/default data ([concretization](https://wikidiff.com/concretization/abstraction) by adding information/exemplification to the code so that dynamics may be treated the same as statics), and then infer the data type from there. F.ex. instead of `const name: string = api.getName()` you'd have `const name: “John Doe” = api.getName()`, where the string data type is inferred from `"John Doe"`. That way you could potentially run some functions at compile time using the default values. Could this end the statics dynamics biformity? IDE tooling could show the programmer real defaul/mock data propagating through the app during development ([Bret Victor](http://worrydream.com) style), like it shows the type inference today. Maybe we can [compromise with Rich Hickey's aversion to static types](https://www.reddit.com/r/Clojure/comments/tt88b0/questions_about_rich_hickeys_comments_on_static/) and instead of having one or more _optional_ tests of the code, through some extra code, like Clojure's spec, we could have enforced those tests declaratively throughout the code, akin to static types, but with actual values (like exemplified above). Functions could more easily be [run at compile-time](https://kristoff.it/blog/what-is-zig-comptime/) (since they'd have default/mock values, not merely a type specification), without needing to create a separate (potentially turing-complete..) additional language (like a static type system does) to declare the types of data those functions would take. Nor would the programmer have to reason about data types in the abstract, and how they can combine (i.e. [type theory](https://en.wikipedia.org/wiki/Type_theory)). In this, we are more inspired by [Clojure's focus on raw data](https://www.youtube.com/watch?v=aSEQfqNYNAc&t=1s) over classes or nominal types of data. the structural type system would presumably work with the types inferred from the mock data specified, and allow a certain flexibility, while also warning the programmer about inconsistent usage. See also point on 'Syntax matters (and homoiconicity is a plus)', for how this solution aids in combining homoiconicity with static typing.
   
    
# Maintainability, refactorability, reuse

* Be [general purpose enough](https://github.com/nagydani/seedling/blob/master/RATIONALE.md) to at least write scripts and CLIs, but also web servers/clients.
    
* No super-powerful tools which may hurt you or others in the long run. Counter-inspired by meta-programming in Ruby.

* [The Expression Problem](https://eli.thegreenplace.net/2016/the-expression-problem-and-its-solutions/): How can we _“define a datatype by cases, where one can add new cases [aka. variants] to the datatype and new functions over the datatype, without recompiling [or refactoring] existing code, and while retaining static type safety (e.g., no casts).”_  ([orig. definition](https://www.giacomodebidda.com/posts/3-ways-to-solve-the-expression-problem/))? We want to be able to both _“introduce new functions acting on existing data types”_ and _“introduce new cases/variants of existing data types and be able to act on them by using existing functions”_. The goal is to achieve this extensibility in both dimensions (data types and functions) simultaneously, while retaining static type safety, and without requiring modification (recompilation or refactoring) of existing code (since it may be potentially unknown/uncontrolled third party source code that we might not have access to).
  (In object-oriented programming (OOP), it is relatively easy to add new data variants by creating new subclasses, but adding new operations typically requires modifying existing classes, violating the [open/closed principle](https://en.wikipedia.org/wiki/Open%E2%80%93closed_principle). Conversely, in functional programming (FP), it is easy to add new operations by defining new functions, but adding new data variants requires modifying existing functions that pattern match on the data type.)
  **Solution:** Overload functions statically (compile-time) based on function name and parameter labels (aka. keyword arguments). No dynamic dispatch (runtime polymorphism), no multiple dispatch, and no dispatch based on argument types (since it's not fully disambiguating, if overloaded functions use the same data types). Disallow dynamic arguments (aka. rest parameters / arguments object), since they complicate static overloading of functions. (Types must be resolved at program boundaries. To ensure determinism within program.). To solve the first part of the expression problem: Use opaque types and type extensions. Inspired by Gleam and inspired by Clojure's `extend-type`. To solve the last part: Use function composition and higher-order functions. Inspired by Gleam. Basically create and use a new function that delegates to a new function for the new data type variant, and to the existing function for the rest.
  The language should attempt to keep data (types) and functions separate/orthogonal, as far as is both possible and pragmatic. Inspired by [Don Syme’s philosophy for F#](https://github.com/fsharp/fslang-suggestions/issues/243#issuecomment-916079347), and [Clojure's open methods / multimethods](https://eli.thegreenplace.net/2016/the-expression-problem-and-its-solutions/). Also inspired by Rust traits (which are also [explicit and local](https://youtu.be/hcK3N_Y3hzM?t=834); enabling safe/localized monkey-patching...).
  But ideally, maybe the expression problem is premised on the wrong thing, since: We don't really want different 'variants' of data types. Because it introduces variability, which represents entropy/unpredictability, and we want to "get to concrete as fast as possible" (inspired by Christopher Alexander, [via Basecamp](https://basecamp.com/gettingreal/06.1-race-to-running-software)), which will also help the compiler (see 'concretization').
    
* Reactive and **Streamable**. Inspired by [Functional Reactive Programming, and Elm](https://www.youtube.com/watch?v=Agu6jipKfYw), and [The Reactive Manifesto](https://www.reactivemanifesto.org/). Though the latter is geared at distributed systems, it could also be a model for local computation (rf. Actor model, and [Akka](https://akka.io/)). The programming language should make default and implicit the features of reactivity and streaming, as opposed to preloading and batch processing. (Reactive Streaming Data: Asynchronous non-blocking stream processing with backpressure.) The programmer shouldn't have to think of reactivity and streaming explicitly. Preloading and batch processing should just be a special case (stream 1 value/batch instead of several). Counter inspired by Promise API in JavaScript. Going from rather static data structures like arrays, into dynamic ones, such as a stream, shouldn't need a code re-write. They're both sequences of values, after all, and *WHEN* the data arrives should not need to be a concern to the algorithms implemented on that data (see 'The Hairy Vision' section). See the related concept of fuctional [transducers](https://medium.com/javascript-scene/transducers-efficient-data-processing-pipelines-in-javascript-7985330fe73d)), which could afford such operations (effectively eliminating unnecessary data materialization during program execution). The language should assume that values can arrive over time, and that processing values in an end-to-end pipeline is better done one value at a time, so that values start arriving at the other end sooner rather than later. Inspired by [Lean manufacturing principles](https://en.wikipedia.org/wiki/Lean_software_development#Lean_principles) ([WIP-limit](https://www.atlassian.com/agile/kanban/wip-limits) is set to 1 when on a single CPU, or potentially higher WIP limit with more CPU's, effectively parallel processing a fast arriving stream of incoming values, f.ex. within a web service request as opposed to only parallel processing between requests) vs. Waterfall (data materialization and batch-processing) processing pipelines. Also inspired by Clojure's `seq` ([sequence](https://subscription.packtpub.com/book/application-development/9781785889745/1/ch01lvl1sec13/thinking-in-sequences)). But how to deal with streams rather than arrays, when arrays are more optimal/predictable to deal with in terms of memory management? The compiler could possibly deduce the size of an array from its usage in the code, instead of the programmer having to declare it up front, which would then need to incidentally/manually correspond with its later usage. In short: Why not go the other way around than what's normal, and treat the static sizing of an array as an optimization step? This optimization could be done for the code the compiler has access to, but for values arriving in streams from external third party sources, it could obviously not be performed. If you are fundametally dealing with streams, rather than arrays, it may pave the ground for easy [Dataflow-programming](https://en.wikipedia.org/wiki/Dataflow_programming), using FP. When new values arrive, they follow the same functional pipeline as those before. Arrays would simply be *finite* streams, and as far as possible they would be streamed into a continuous block of memory. The bounds of the memory block could be deduced by the compiler, or alternatively the programmer can set aside an initial decent minimal chunk of memory upon declaration. Similar to specifying size upon array creation in various languages today, but with the possibility to overflow into free store memory. (Another interesting idea here is to cater to stream matrices instead of just array-like sequences; maybe as streams within streams).
    
* [Content-addressable code](https://youtu.be/gCWtkvDQ2ZI?t=170): names of functions are simply a uniquely identifiable hash of their contents. The name (and the type) is only materialized in a single place, and stored alongside the AST in the codebase. Avoids renaming leading to breaking third-parties, and avoids defensively supporting and deprecating several versions of functions. Avoids codebase-wide text-manipulation, eliminates builds and dependency conflicts, robustly supports dynamic code deployment. Code would also need to be stored immutably and append-only for this to work. All inspired by [Unison](https://www.unisonweb.org/).
    
* [**Backward- and forward-compatible**](https://youtu.be/A3AdN7U24iU?t=2029). Should be able to not worry about (or make poor future tradeoffs due to) backward-compatibility. ([Counter-inspired by ECMAScript](https://maggiepint.com/2017/04/11/fixing-javascript-date-web-compatibility-and-reality/) and C++). To make the language optimally and freely evolvable, and worriless to upgrade. [Backward-compatibility](https://en.wikipedia.org/wiki/Backward_compatibility) and [Forwards-compatibility](https://en.wikipedia.org/wiki/Forward_compatibility): Code in a one language version should be transformable (in a legible way) to another version (both ways; backward and forward). In the case of lossy changes, the old version should be stored (so it is revertible), and in the case of a "gainy" changes then the compiler should notify the programmer where in the code it is now missing explicit information (based identifying locations in the code where the old language constructs are used). There should also be solutions to either: have simple CLI tools to **automatically refactor old code to new language versions**, to always stay optimally **adaptable**, without having breaking changes. Maybe using some form of **built-in self-to-self transpilation**. Will likely need to be able to treat code-as-data. Might need compile-time macros. Or a solution could be to: with every breaking language revision, include an incremental language adapter, which would allow upgrading whilst ensuring backward compatibility. Could be solved with [Mechanical Source Transformation](https://go.dev/blog/gofmt), enabled by gofmt, so developers can use [gofix](https://go.dev/blog/introducing-gofix) to automatically rewrite programs that use old APIs to use newer ones. Which is crucial in **managing breaking changes**. A breaking (aka. widely deviating) change, should in effect, not actually break anything (that current languages and systems do, is considered a "pretty costly" design flaw). *"Successful long-lived open systems owe their success to building decades-long micro-communities around extensions/plugins"*, and to enable that requires great care for backwards-compatibility, as Steve Yegge [pointed out](https://steve-yegge.medium.com/dear-google-cloud-your-deprecation-policy-is-killing-you-ee7525dc05dc). But tool based upgrades, as mentioned, is better than keeping old APIs around forever. This philosophy is also applied by Carbon (C++ successor language). See 11:43 @ [https://youtu.be/omrY53kbVoA](https://youtu.be/omrY53kbVoA)
    
* **Scalable**: From single core to multiple core CPUs, and from one to a distributed set of machines. Without needing refactors (or only through swapping out some keywords/libraries). Inspired by Smalltalk, FP principles, and [Venkat Subramaniam's talk](https://youtu.be/0hQvWIdwnw4?t=1133). This is called [Location Transparency](https://www.reactivemanifesto.org/glossary#Location-Transparency), and *"Embracing this fact means that there is no conceptual difference between scaling vertically on multicore or horizontally on the cluster"*. Inspired by Alan Kay's vision of computing, and the purpose of the [Actor Model](https://www.brianstorti.com/the-actor-model/), utilized in Erlang/Elixir and [Pony's actors (w/ async functions)](https://tutorial.ponylang.io/types/actors.html). But rather than using state-driven Actors, I'd rather want it implemented with stateless "Machines" (a concept I made up), which would simply give stateless functions a call queue each. Inspired by [Smalltalk](https://blog.metaobject.com/2019/11/what-alan-kay-got-wrong-about-objects.html), but stateless. They call each other by sending Messages (containing the parameters) to the other function's call queue, take into consideration error-handling, and the [unreliability of distributed computing](https://en.wikipedia.org/wiki/Fallacies_of_distributed_computing). (The caller chooses if their call should be sync/blocking or async/non-blocking, since sync/async aka. blocking/non-blocking, is not a feature of the called function, but the call itself. [*Async is not an adjective but an adverbial*](https://twitter.com/magnemg/status/1498758939411984390?s=20&t=22EsOqyL0E4KjTIczit4Zw)*!* [Counter-inspired](https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/) by [JS](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Asynchronous/Async_await), and inspired by the `go` keyword of Golang on function invocation/callsite.) We name such functions "Machines". Each of them are in fact a mini-computer, or a [computer-within-the-computer](https://blog.metaobject.com/2019/11/what-alan-kay-got-wrong-about-objects.html), if you will, but unlike Actors they don't have inherent state (which rather ought to be stored and managed by a DB, or in-memory DB). Such Machines should be able to be moved to distributed systems without rewriting the code. Inspired by Alan Kay and Actor Model systems (Akka), [Big-bang FP](https://www.youtube.com/watch?v=ayoofXuKqMY) and [Syndicated Actors](https://syndicate-lang.org/about/history/) which are based on the converse of Metcalfe's idea: *"inteprocess communication might be networking communication"*, that is, *"primitives we choose for our programming languages and programming models could be drawn more directly from our experience of computer networking"*. The Machine concept is also inspired by languages where actors are first-class citizens, like in [Pony](https://tutorial.ponylang.io/types/actors.html). A single Machine could work as a minimal microservice, or better yet, a Cloud Function, but likely you'd want multiple endpoints which expose a Machine each.
    
    * **No global variables**: Because [global variables are a bad practise](https://www.baeldung.com/cs/global-variables), and they don't translate well to a distributed system setting, so scaling up a code-base from single machine to multi-machine when using global variables can't be done without a rewrite. Instead, a function can call another function by simply sending a message. Inspired by Smalltalk. See aforementioned "Machine" concept. Messages can be passed through chains of function calls by piping and/or [`...rest` parameters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters).
        
    * No [variable shadowing](https://en.wikipedia.org/wiki/Variable_shadowing) *within* functions, but insides of a function may shadow the outside. Inspired by [C#](https://ericlippert.com/2007/08/14/c-and-the-pit-of-despair/). Since variable shadowing is [a reason](https://forum.rescript-lang.org/t/let-keyword-needed/2899/6) to have keywords such as `let`, then *not* allowing variable shadowing could afford the opportunity to avoid having such keywords as `let` or `const`, for minimalism (since all values should be immutable anyway). So functions should allow [shadowing external variables](https://github.com/jashkenas/coffeescript/issues/2697#issuecomment-13279409) to the function, since it ensures the writer/reader of the function doesn't need to know about, or be constrained by, potential name collisions with external/global variables (see: function independence). In general, the language should restrict global variables to module namespaces. When global variables are used, they should be accessed locally by calling a global function. Inspired by [Python](https://gist.github.com/iankronquist/99db09745d4df46b5d8b933f5bd80c3c#file-2_scope-md)'s use of the `global` keyword. Or, globals should be accessed directly using a `@@` prefix to their name, like Ruby does for static variables. But in all: There shouldn't be various shadowing rules for various kinds of scope, but one simple shadowing rule for functions (and functions should be the general scope of choice).
        
    * Facilitate and nudge developers's towards creating [Functional Core, Imperative Shell](https://medium.com/@magnusjt/functional-core-imperative-shell-in-javascript-29bef2353ac2) [architectures](https://www.destroyallsoftware.com/screencasts/catalog/functional-core-imperative-shell) (inspired by [Bernhardt at 31:56 in his Boundaries talk](https://www.destroyallsoftware.com/talks/boundaries)), to preserve the purity of functions as far as possible, while also **containing side-effects**:

        * **Configurable language**: [Platform framework/config](https://youtu.be/cpQwtwVKAfU?t=976) that encapsulate all I/O primitives, which introduces a separation between trusting a particular platform and trusting the language runtime. Inspired by [Roc](https://youtu.be/cpQwtwVKAfU?t=1034). This could make programs more portable, since the programmer does not directly hardcode with platform I/O primitives afforded by the language runtime, but writes code via the [Platform API](https://youtu.be/cpQwtwVKAfU?t=788). It could even make certain features of the language only available on certain platforms, i.e. Browser platform doesn't have access to low level memory management. So that the language can be as restrictive as possible for the environment, ensuring that code is written idiomatically for the target platform / environment, since a restricted language has value because for a given platform the programmer would encounter less diversity in the language and thus have less to learn. This strikes a balance between on one hand providing sharp knives as global tools programmers can apply anywhere (i.e. potential footguns, leading to [The Pit of Despair](https://ericlippert.com/2007/08/14/c-and-the-pit-of-despair/) like in C++), and on the other hand avoiding being so restrictive that programmers can't talk/write/think about what they want/need to for their given environment. The language itself should be [massively configurable](https://youtu.be/Bs44qdAX5yo?t=1420): **It is not reasonable to assume that the language designers will have accounted for all possible usecases** (various memory management strategies etc.). So the language primitives/keywords should be able to be given different underlying effects (e.g. [stack vs. heap allocation](https://ziglang.org/learn/why_zig_rust_d_cpp/#no-hidden-allocations)) based on which platform or use-case is specified (without having to be explicit about every such effect in every environment). But the effects should be inconsequential for the reasonability of the code. Meaning that they should be at the bare-metal performance level, not at the level where operators are overloaded to do something different, cf. our principle that *things that are different (i.e. have different effects at the language level the programmer is operating at) should look different*. The platform config will depend on which implementation makes most sense for that platform (or use-case?) (i.e. browser webapp vs. systems development, vs. game development, potentially). [The language should be configurable by libraries](https://youtu.be/Bs44qdAX5yo?t=1420), that will define how it works, and can extend the core to platforms where the programmer needs to think about specific matters to that platform. Inspired by Clojure. **The same program specification should be able to have different runtime characteristics on different platforms**, depending on the platform configuration. This could be enabled by the programming language concerning itself with modeling causal relationships, instead of [place-oriented-programming](https://github.com/matthiasn/talk-transcripts/blob/master/Hickey_Rich/ValueOfValues.md).
            
        * **Encapsulated I/O**, so functions can avoid having side-effects. Inspired by Haskell.
          - **Alternative #1:** [Algebraic Effects](https://overreacted.io/algebraic-effects-for-the-rest-of-us/) for I/O, so that side-effects can be contained in a given context. Algebraic Effects are also a powerful general concept that [could](https://news.ycombinator.com/item?id=14781900) help with concurrecy, async/await, generators, backtracking, etc. Inspired by [OCaml](https://www.janestreet.com/tech-talks/effective-programming/). 
          - **Alternative #2:** use [an IO action of an IO type](https://blog.jle.im/entry/io-monad-considered-harmful) (inaccurately named "IO Monad" at 30:44 in the [Boundaries talk](https://www.destroyallsoftware.com/talks/boundaries)), transparently (without actually having to [deal with the concept of a Monad](https://www.google.com/search?q=what+is+a+monad+meme&client=firefox-b-e&source=lnms&tbm=isch&sa=X&ved=2ahUKEwjdu9i0ocXyAhWZS_EDHdiqDZcQ_AUoAXoECAEQAw&biw=1512&bih=833)). Where you effectively [construct a sequence of I/O operations to be executed later](https://stackoverflow.com/a/48413048/380607). Inspired by [Haskells separation between pure functional code and code that produces external effects](https://youtu.be/iSmkqocn0oQ?t=184). Compare with the concept of a [functional core, imperative shell](https://medium.com/@magnusjt/functional-core-imperative-shell-in-javascript-29bef2353ac2) architecture (at 31:56 in Bernhardt's [Boundaries talk](https://www.destroyallsoftware.com/talks/boundaries) and the ['functional core imperative shell' code talk](https://www.destroyallsoftware.com/screencasts/catalog/functional-core-imperative-shell)), a concept which was inspired by Haskell. Something like this is needed because the Mailbox is stateful (it is constructive/destructive, like a queue), and I/O messaging would be a side-effect. The Machine/Mailbox is inspired by the Actor Model from Erlang. Ideally, since all I/O is wrapped, it should be able to turn on/off the execution of IO actions, based on setting some initial config. This could be useful for testing. You could even do a sample run to collect data, which you could snapshot to use as mock data for test runs.
          - **Alternative #3:** Potentially by syntactic rules/enforcement: You have *functions*, that always return a value (and have no side-effects, i.e. are always pure), and *procedures*, which never return a value, but imperatively perform side-effects (e.g. akin to a function executing side-effects and simply returning void). Procedures can contain functions (since functions are pure they are predictable), but functions cannot contain procedures (since that would make them impure, and side-effects are unpredictable and would be hidden/surprising). Inspired by Algol and Pascal. This way you could automatically enforce [functional core, imperative shell](https://medium.com/@magnusjt/functional-core-imperative-shell-in-javascript-29bef2353ac2) architectures, as you'd have to do all side-effects inside procedures. Programs would be a nested hierarchy of procedures, with functions interspersed at any level, as needed. Functions could contain their own pure functional hierarchies. Importantly, I/O (or other side-effects) would not be allowed from within functions, only from within procedures (even for `console.log`, so function hierarchies would have to be debugged through unit-testing individual sub-functions, inspecting their result). NB: Could lead to [the colored functions problem](https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/), since if procedures are more powerful/permissible than functions, then programmers may just default to using procedures everywhere, and programs would simply be nested procedures. But at least it would be more predictable if you could easily/visually tell functions and procedures apart. Unless people used procedures where they could/should have used functions.. but it should not be a problem, since procedures can't return anything (only void), so when you want to return a result you would need to use a function. Maybe this could [de-complect](https://github.com/matthiasn/talk-transcripts/blob/master/Hickey_Rich/SimpleMadeEasy.md) functions and procedures, which have been too closely intertwined through historical circumstances (maybe it was it too tempting to have the `console.log` ability from inside functions?). Maybe colored functions aren't so bad, if they [can help nudge developers towards a "functional core, imperative shell" architecture](https://betterways.dev/functional-core-imperative-shell), effectively [keeping procedures and functions separate](https://dev.to/redbar0n/functions-vs-procedures-keep-them-separate-5ed7).
          - **Alternative #4:** Use [Uniqueness Type](http://lambda-the-ultimate.org/node/2708), which allows mutability and pass-by-value while also preserving the crucial [**referential transparency**](https://sookocheff.com/post/fp/why-functional-programming/) (since side-effects are ok in a pure language as long as variables are never used more than once). Inspired by [Clean](https://en.wikipedia.org/wiki/Clean_(programming_language)) and [Idris](https://www.idris-lang.org/). Possibly use [Simplified Uniqueness Typing](https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.142.5413&rep=rep1&type=pdf), inspired by [Morrow](https://www.openhub.net/p/12489). 
          - **Alternative #5**: Simply be able to turn on/off side-effects like external output operations. If all output operations are done through an IO module in the standard library, it could afford a simple "off" switch, to be able to do testing. That would prevent side-effects from acting on the outside world during testing. The challenge is [side-causes](http://blog.jenkster.com/2015/12/what-is-functional-programming.html) (aka. hidden inputs), however. The language could have the IO module require a default/fallback parameter to be set for successful external input operations. `IO.readFromFile(fileName, "Default file content fallback.")`. Which would be used during testing (the benefit being that the mocks would already be present). Another problem with side-effects have to do with ecosystem (especially interop with other languages): If you use a 3rd party package, how do you know it won't leak data to a 3rd party server during runtime? This ought to be solved by a sandboxed runtime environment (inspired by Deno), where it should automatically log any attempts at IO access not explicitly made through your own application code (using the language's IO module). Inspired and counter-inspired by [Elm](https://guide.elm-lang.org/interop/limits.html).
            
        * Ideally, for performance, when the code is compiled to be run on a single machine, the compiler should be able to be optimise away the Mailboxes, so that Machines can be turned into (simpler and faster) synchronously executed functions.
            

# Performance

* [Zero-cost abstractions](https://reintech.io/blog/understanding-rust-zero-cost-abstractions). Inspired by Rust.
  * A [single string type](https://youtu.be/CpvzeyzgQdw?t=436). Counter-inspired by Rust. The compiler should check whether the string is modified, and if it is then it should use a dynamic/variable length string, otherwise it should optimize by using a static fixed-size string. The programmer should not have to worry about this optimization difference. Be as generic as possible, but make static optimisations for different contexts.
  * The compiler should optimize performance by making calls synchronous on a local Platform (single machine), that would otherwise be made async on a networked/distributed Platform.
  * Compile-time macros could presumably help with this.

* No single-threaded event loop that can block the main thread. Counter-inspired by JS. Instead, inspired by Golang, create a set of threads in the core runtime and run hundreds of goroutines on them by multiplexing. But unlike Golang, the runtime should not only create a goroutine per web request, but also create goroutines for every parallelizable part of the program, so that even a single web request / program can be divided and executed in parallel (if it needs to, due to being computationally expensive). The adaptive runtime and/or user config should decide the amount of access to the core threads, and allowed run time for each program (so a heavy program doesn't starve other web requests).

* **Async, Event-driven, Streamable, Parallelizable**, all by default. Which would effectively take these concerns out of the equation, freeing the application programmer from thinking of implementation details (like how the computer should work efficiently, which is the language/framework designer's job), to _restructuring or rephrasing the problem into sub-problems_, and making those explicit, so the computer can efficiently parallelize computation at the right points.
  - The largest performance gains are often not in working faster, but in [eliminating/reducing the work to be done](https://youtu.be/up0kiOJvUpI?t=2832). (Since *"constraints liberate, liberties constrain"*, as [Runar Bjarnason said](https://www.youtube.com/watch?v=GqmsQeSzMdw): _"As programmers, we tend to think of expressive power of a language or library as an unmitigated good. In this talk I want to show the contrary; that restraint and precision are usually better than power and flexibility. A constraint on component design leads to freedom and power when putting those components together into systems. What’s more, this feature is built into the very nature of language and reasoning."_ -- Runar Bjarnason. When all functions and data structures in the language support these features, you'd gain unrivaled program composability (and scalability: from single machine to distributed).
  - Imagine a program taking in an array, item by item, streaming it into parallel pipelines (which transform the data according to a sequence of [transducers](https://clojure.org/reference/transducers)), and simultaneously, while the pipelines are processing, they stream back the response, item by item, into either the array itself, or a new data structure, or some output destination. Streams breaking apart, parallel processing, and weaving together again, multiple times at different points throughout the program, and every step funneling through item-by-item - [Lean Manufacturing](https://www.unleashedsoftware.com/blog/one-piece-flow-manufacturing-the-key-to-boosting-efficiency) style, according to a pre-designated [WIP-limit](https://www.atlassian.com/agile/kanban/wip-limits) (a limit of work allowed to be in process at any given time) - not having to wait for the full processing completion of the previous items, and never having to fully (re-)materialize the data on each step in the pipelines.
  - **Syntax-wise** you'd write the pipelines data-first left-to-right, i.e. in the chronological way that data would flow. So it will be easy to follow and trace the execution step-by-step from beginning to end as you read along. But the compiler should read the functions from right-to-left first (alternatively read left-to-right but upon encountering a function stop data processing and start collecting all subsequent functions), so that it can compile the list of functions into powerful composed (partial) functional expressions that can operate on data without materializing the data at every step when executing left-to-right (inspired by '[transducers](https://clojure.org/reference/transducers)' and inspired by the concatenative [Om](http://www.om-language.org/) language). (The IDE should give notice about which data is potentially missing as an input to a step in the functional pipeline, either when you try to call a function at a step, or based on a partial function resulting from a constructed pipeline that doesn't include all input data (yet).) This is the exact inverse of functional languages that read function compositions left-to-right first but then execute with data right-to-left. Since I think it's vitally important to enable the programmer to *trace the flow of execution* by simply reading the code left-to-right (re: Dijkstra's impetus to "spreading out the process in text space"). This may open up a potential for **optimal memory management**: If the compiler reads the functions from right-to-left first (i.e. from the end of the program back to the beginning), then when it first encounters an input variable to a function it knows it is the last use of the data referenced by that input variable (see [object lifetimes](https://en.wikipedia.org/wiki/Object_lifetime)). So one idea is that it can automatically insert an instruction to free that memory, after the function has given its output. Effectively avoiding both compile-time reference counting, runtime reference counting, and garbage collection.
  - **Locality of the data and the code** should be handled by the adaptive runtime (see point on 'adaptive runtime'). Meaning that the runtime should decide whether or not to execute something locally or across the network. Maybe either depending on the given size of the data, if determinable upon compilation, or by runtime analysis of the data size, or runtime adaptations based on processing time (akin to how JIT compilation optimizes program execution during runtime). Alternatively it could be managed by configuring the adaptive runtime more statically, into various modes: local-only, or full-network-distribution of the data and code. To take advantage of the environment and available hardware the programmer should know about. But ideally, the adaptive runtime should take care of all of this, and be able to adapt to changing hardware and network environments, to achieve the optimal performance at all times without reconfiguration.
  - Error handling (restarting failing processes, inspired by Erlang) and potential hardware stragglers that fall behind in processing, should be taken care of by the adaptive runtime, for optimizing the speed of getting the end output from the weaved pipelines. It could choose to execute some parallel pipelines locally instead of across the network, or reuse hardware that has become idle, if the stragglers take too long. Similarly with deciding what parts of the data it should keep in RAM vs. on-disk, and how often it should persist to disk (according to some fault-tolerance and persistence configuration/policy).
  - Mutation: Data-flow languages are typically based on immutably consuming and generating tokens, which generates [overhead](https://web.engr.oregonstate.edu/~benl/Publications/Book_Chapters/Advances_in_Computers_Dataflow93.pdf) (processing and re-materializing a large token store / large arrays of data), especially for applications with a low degree of parallelism. So the language should allow mutating existing data structures: you could **stream the result of data (passed through a pipeline of composed functions) _back into_ the origin data structure, value-by-value**. Just as-if you were imperatively performing multiple operations on each value in an array for each step in a single pass / for-loop over the array. Even when functional oriented, it has to be as efficient as that, to be performant. You don't necessarily need immutability everywhere, as long as you can restrict mutation. Inspired by Rust's ownership-borrowing system. The language should be similar to [data-flow languages](https://stackoverflow.com/a/949771/380607) in purpose and use, but similar to control-flow languages in implementation: since streaming instructions over static data is faster and more scalable than always streaming data (token-by-token) over static instructions/operands (like data-flow languages do). Amount of instructions are generally a lot less than amount of data items, and it's always a benefit if you can minimize the shuffling around of data. However, when functions are called over a network boundary (RPC), then data must be immutably materialized (and serialized) at those function boundaries, and transmitted across the network (instead of functions merely mutating the data, as done locally). But crucially, the same flow-oriented functional pipeline should be able to be used either locally or over-the-wire without any changes to the code (other than imports / platform config).
    
* **Aggressively Parallelizable**: Parallelization made natural. [Aided by pure functions](https://en.wikipedia.org/wiki/Purely_functional_programming#Parallel_computing), which are ideal for parallelization (and [even for streams](https://github.com/adityagarde/parallel-asynchronous-java#streams-api)). In FP code the structure of sequential and parallel code is very closely aligned (as opposed to in imperative code). See also the point on 'DFFP'. The language should nudge programmers and make it easy/natural to use parallelism, through language constructs like [executing several sequential lines simultaneously](https://youtu.be/XlvfHOrF26M?t=109) (inside fork/join constructs or similar). To avoid common [*overly* sequential thinking](https://news.ycombinator.com/item?id=28213940), which can lead to suboptimal performance (due to not parallelizing work). But humans think sequentially. So we ought to pay heed to [Dijkstra's wisdom](http://www.dcs.gla.ac.uk/~pat/cpM/jchoco/nqueens/Goto-Harmful-Dijkstra.pdf) that since: *"our intellectual powers to visualize processes evolving in time are relatively poorly developed, we should shorten the conceptual gap between the static program and the dynamic process, by spreading out the process in text space"*. In simpler terms: enabling the programmer to *trace the flow of execution* by simply reading the code. As elsewhere mentioned: execution order should follow the reading order. Another important reason the language should steer the programmer to aggressively utilize parallelization, is due to [Amdahl's Law](https://en.wikipedia.org/wiki/Amdahl%27s_law), which states that, when parallelizing, the limiting factor will be the serialized portion of the program. Which is, notably, the queueing delay, due to contention over shared resources, like CPU time. So whatever part of the program which is not parallelized, will eventually, under high enough load, turn into a bottleneck. The language construct nudging developers to parallelization could be inspired by [Verilog's fork/join](https://en.wikipedia.org/wiki/Verilog#Fork/join) construct, or the very similar [Nurseries](https://vorpus.org/blog/notes-on-structured-concurrency-or-go-statement-considered-harmful/), which are an alternative to `go` statements (since `go` statements don't afford local reasoning, automatic error propagation and reliable resource cleanup, though some may be achieved in a [WaitGroup](https://pkg.go.dev/sync#WaitGroup)). But as opposed to the [fork/join example](https://en.wikipedia.org/wiki/Verilog#Fork/join), the language should enforce a deterministic order upon joining, which should simply be guaranteed by the sequential top-down order of the lines in the fork/join code block (a novel idea, to my knowledge, which would need to be experimented with thoroughly... more thoughts in [this issue](https://github.com/carp-lang/Carp/issues/1149#issuecomment-1021187461)). NB: Need to research if on today's hardware, automatic parallelization could in fact be a potential pessimization in practice instead of an optimization, as Richard Feldman pointed out to me. In any case, we do not envision making every function call parallelized, but to make simple, contained constructs (like nurseries, fork/join), that the programmer can use to signify separable pieces of the problem/algorithm. The runtime should then parallelize those portions aggressively. *"Whether to be sequential or parallel is actually a separable and orthogonal question. ... allow not just the compiler, but the runtime to make the decision on the fly based on available resources to decide whether to break up sub-problems in a linear fashion or in a divide-and-conquer fashion."* -- Guy Steele, in [How to Think about Parallel Programming: Not!](https://github.com/matthiasn/talk-transcripts/blob/master/Steele_Guy/ParallelProg.md). This ties back to the point that **programming needs to get away from the notion that the programmer is giving instructions to the machine.**. See 'Declarative over imperative'. It could be helpful to *"separate the meaning of a program from the implementation details. ... Saying less about implementation should also make programs more flexible."* -- Paul Graham in [The Hundred-Year Language](http://www.paulgraham.com/hundred.html). In all, the language should afford algorithms to be broken up into their separable and independent pieces of code, and then the runtime should decide whether to run the pieces sequentially, or in parallel.
    
    * Alternatively: Take inspiration from [Chapel](https://chapel-lang.org/docs/examples/hellos/hello4-datapar-dist.html), by providing core primitives to control parallelization directly. But preferably through declarative means and not through such imperative control structures as for-loops, which [Chapel uses](https://chapel-lang.org/docs/examples/hellos/hello4-datapar-dist.html).
        
    * Alternatively: Take [inspiration from Golang's elimination of the sync/async distinction](https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/) and allow programming everything in a sequential manner, but do a degree of parallelism under the hood (so concurrency, in practise). The sync/async barrier elimination, however, doesn't necessarily nudge programmers towards using parallelization (spinning off new threads) within the context of a program (thread). That style might conflict, or it might be synergistic with the goal of nudging programmers towards making more use of parallelization.
        
    * **Syntax enabled parallelization**. Inspired by [Verilog](https://en.wikipedia.org/wiki/Verilog#Fork/join) and [Chapel](https://chapel-lang.org/docs/examples/hellos/hello4-datapar-dist.html). Ideally, the language runtime should be able to use parallelization to handle multiple independent processes (like client/server requests; goroutines for concurrency), but also *automatically distribute a single program across multiple CPU cores (facilitated implicitly by the language constructs/structure, without special imperative directives like thread/go)* when those cores are idle. To do that, the language should [not attempt to automatically make *specifically sequential* code parallel](https://web.archive.org/web/20150226021702/http://joearms.github.io/2013/03/28/solving-the-wrong-problem.html), since such [automatic parallelization](https://en.wikipedia.org/wiki/Automatic_parallelization) requires complex program analysis based on parameters not available at compile-time. Instead, the language should nudge towards constructs that afford natural use of multi-threading instead of single-threading (cf. principle that a language should afford *scalable modes of thinking*). But without compromising readability/reasonability, which is the top priority. The programmer should be concerned with, and simply **describe independent sets of causal/logical connections**, and the language runtime should automatically take care of as much parallelization as possible/needed. Inspired by [Haskell](https://www.oreilly.com/library/view/parallel-and-concurrent/9781449335939/pt01.html).
        
    * [Safe parallelization](https://youtu.be/iSmkqocn0oQ?t=182). Inspired by [Haskell](https://www.oreilly.com/library/view/parallel-and-concurrent/9781449335939/pt01.html).
        
* **Adaptive runtime**. The language should have a small, but adaptive/capable runtime. Small in the sense that the runtime should have no GC, and its implementations should have a high level of [mechanical sympathy](https://dzone.com/articles/mechanical-sympathy) with the target platforms (see 'Configurable language'), so that the CPU operating cost of the runtime is as small as possible. But I'd trade the size of the runtime so it is larger, if it means app developers have to be concerned with less. The runtime could be worked on by specialist programmers that could hyper-optimize it. Inspired by V8 for JavaScript. _Better that specialists work on optimizing the runtime for everyone, than every app developer having to make (the same) performance optimizations themselves._
  * Single-threaded to multi-threaded: The same code (or only with slight modifications) should be able to be run in a single thread in one context (e.g. in a client's browser), and take advantage of multi-threading in another context (e.g. server-side). Multi-threading should be the language default, but the runtime should be able to support concurrency (interleaving threads into a single thread), for use cases that require that (e.g. like if if compiles to JS and needs to execute in a browser or Node.js runtime). But it should be so configurable that the programmer could configure the runtime so that e.g. the compiled JS running on client side would use Service Workers for threads in addition to the main thread (where possible, so not for operations on the DOM).
    
* Compiled, interpreted and/or incrementally compiled (for dev mode). Inspired by [Dart](https://twitter.com/mayurdhurpate/status/1205190414510116864?s=20).
    
    * Fast compilation. Inspired by ReScript. Fast compilation speed is more important than high-level language features. Using high-level language features like Polymorphism can even severely de-optimize an otherwise fast program (["Clean Code", Horrible Performance](https://youtu.be/tD5NrevFtbU?t=728)). So such features should be possible to restrict (or be disallowed entirely in favor of simpler approaches, [e.g.](https://youtu.be/tD5NrevFtbU?t=728): using if or switch statements, or some form of explicit branching, instead of polymorphism.), to gain faster compilation speed. Inspired by [Molly Rocket](https://youtu.be/tD5NrevFtbU?t=728) in that video, and [Cheng Lou](https://youtu.be/mVVNJKv9esE?t=914) behind the fast ReScript compiler. Configurable language (think strict mode). But readability and reason-ability should be prioritized over compilation speed. Conserving developer mind cycles are more important than conserving CPU cycles. As long as compilation doesn't become a significant local development burden. So incremental compilation is important. Inspired by the Salsa compilation framework for Rust (via [Lark](https://github.com/lark-exploration/lark)), which is aided by memoization of pure functions. Local development has to be fast, but longer CI/CD build times are acceptable, as long as it scales (non-exponentially). Also: *"Compile time is important, but it’s ok to sacrifice it to reduce design time, debug time and runtime. Machine time is much cheaper than human time, and once you automate a task, a machine runs it more efficiently and reliably. And runtime gets multiplied by the number of devices that run it and the number of times it is run."* -- [natewind](https://github.com/natewind/articles/blob/master/2021-06-26-A-Dream-of-the-Perfect-Programming-Language.md)
        
    * Interpreted / incrementally compiled during local development: So developer can write quick scripts and get fast feedback. Sacrifices some runtime speed in local development for compile-speed. Except it also needs quick startup/load time.
        
    * Compiled: For production. Sacrifices compile-speed for runtime speed. Should use static linkinng to compile all dependency libraries, modules, and the language itself to **a single binary**, for easy deployment to a Lambda function or Docker container (without a base image). Inspired by [Deno](https://youtu.be/SYkzk_j3yb0?t=1334) and [Golang](https://go.dev/solutions/webdev).
        
    * [Small core language](https://youtu.be/yiiDFRs62lQ?t=1167): Compiled down to a small instructions set, which can be used/targeted as a starting point to generate code for other programming languages (i.e. generate JS).
        
    * [Portability](https://youtu.be/yiiDFRs62lQ?t=1245): Be able to target and run on multiple computer architectures.
        
    * [Easy to build from source](https://youtu.be/Gv2I7qTux7g?t=190). Inspired by Zig and Golang.
        
* **Best of Immutability with the best of Mutability**. Using immutable variable names (programmer can treat all variables as constants), while having [opportunistic in-place mutation](https://youtu.be/vzfy4EKwG_Y?t=1380)  (compiler can mutate under the hood, for performance, where possible). Inspired by [Roc](https://www.roc-lang.org/). The goal is to avoid Shared Mutable State, but without excessive copying, so the compiler should detect when a data structure that is Shared (passed into another function) is Mutated there, plus also referenced again later, f.ex. later in the calling function, [as if it's having an identity with a State that changes over time](https://youtu.be/ScEPu1cs4l0?t=1085). Only if it detects these three conditions then it should create an incremental copy of the data structure ([copy-on-write](https://en.wikipedia.org/wiki/Copy-on-write)), using [structural sharing](https://en.m.wikipedia.org/wiki/Persistent_data_structure). The programmer semantically deals with it as if a copy was made each time (i.e. immutable API when reading values), and thus has to declare a new variable/name for every new/updated version of the data structure (since it does refer to something different from the original; [identity across time is a mirage](https://youtu.be/ScEPu1cs4l0?t=1085)). Like when passing in a data structure to a function and receiving a seemingly mutated version as the result. The programmer treats it as if a new copy of the data structure was made (i.e. the API is immutable). But the compiler, which sees the inside of that function knows if the data structure was just read/borrowed (in which case nothing special needs to be done), or if it was attempted mutated (using a mutable API, think [Immer](https://immerjs.github.io/immer/)). If it was attempted mutated, and if the compiler sees that no later references to the original variable is made (like in the callig function's body, after the variable was passed into the other function), then it can selectively optimize by simply mutating the original data structure (since the data structure effectively isn't "shared"; its ownership was effectively just passed around). This is [opportunistic in-place mutation](https://youtu.be/vzfy4EKwG_Y?t=1380). Inspired by [Roc](https://youtu.be/vzfy4EKwG_Y?t=1380). The programmer shouldn't need to think about this optimization, but may enjoy the performance benefit of having data structures that are linearly mutated under-the-hood, where possible, and when shared they'd be optimally (only incrementally) copied. This through [persistent data structures](https://en.m.wikipedia.org/wiki/Persistent_data_structure) (like [Lean-HAMT](https://bendyworks.com/blog/leveling-clojures-hash-maps)) and structural sharing, while also avoiding duplication of data. Inspired by Clojure.
  - Ownership/borrowing should have no special syntax. It should be opaque to the programmer, not explicitly handled by the programmer, as it is a concern of the machine how it optimizes it's handling of data structures (while providing the needed semantic guarantees to the programmer, through strict enforcement in the programming language / compiler). Special knowledge/syntax for (such inherently internal) ownership/borrowing concerns - like [needing to know the in-memory representation of various types of values](https://doc.rust-lang.org/book/ch04-01-what-is-ownership.html) or use special `&` [references](https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html) to allow referring to a value without taking ownership of it - is considered a design inadequacy in the programming language. Counter-inspired by Rust. The programmer should not need to deal with such internal machine concerns.
    
    * [In-place mutation](https://docs.rs/im/13.0.0/im/#in-place-mutation), where data structures only become immutable when they're shared (presumes keeping track of borrowing / reference counting). Inspired by Rust, [Roc](https://youtu.be/vzfy4EKwG_Y?t=1380), and Clojure's [transients](https://clojure.org/reference/transients). Immutability gives the benefit of facilitating concurrency and avoid race-conditions. As a bonus you could get time-series and thus time-travel for data.
        
    * Mutable API: The desirability of a mutable API (mutating objects instead of always having to pass in functions) is inspired by the JS libraries [Immer](https://immerjs.github.io/immer/) and [Valtio](https://codesandbox.io/s/zustand-valtio-jotai-counters-my6np?file=/src/ValtioCounter.tsx:181-205). But for algorithms, instead of using the mutable API in an imperative style, it should allow keeping to a functional style, possibly with something akin to Clojure's [transients](https://clojure.org/reference/transients). Alternatively: A mutable context (block scope) could be mandated for mutations (similar to [Immer](https://dev.to/fkrasnowski/comment/1c706)), which could also afford resource cleanup (if we want to avoid having a GC). Inspired by Rust.
        
    * Deep immutability: Cloning/Copying a data structure should not simply copy references below the first level, or if the data structure contains certain data structures. Because it is unintuitive/unexpected: a copy should be a full copy (at least as far as the programmer is concerned; it can use structural sharing under-the-hood). Counter-inspired by JS/TS. Alternatively: Instead of using Immutability to defeat [Shared Mutable State](https://youtu.be/PNx9WqQ9QeA?t=90), restrict the split-brain duplicity of keeping onto a reference to some data while also sharing a reference to it, like [Rust](https://doc.rust-lang.org/book/ch04-01-what-is-ownership.html#memory-and-allocation) does: by simply disallowing local references to data after it has been shared (aka. "moving" data).
        
    * Memoization, automatically, but measured and only applied dynamically when runtime finds it beneficial. Aided by pure functions. The programmer shouldn't have to think about [memoization](https://en.wikipedia.org/wiki/Memoization) when programming, but should be able to tune the degree of memoization (since it is a space/time tradeoff) through general configuration, for advanced cases not optimal from the default. Run time optimisations such as these are not critical features, but certainly nice to have, and should be considered in the language design in those cases where it can affect the implementation of the language runtime. Memoization of math might not always be worth it ([06:43 @ Andrew Kelley on Data-oriented design](https://media.handmade-seattle.com/practical-data-oriented-design/)) so the adaptive runtime should measure math calculations and decide whether or not to memoize them in main memory (RAM), or just recompute the calculations because the CPU and it's cache are so fast and accessing RAM would be slower. These are hardware concerns that are subject to change as hardware progresses, and such concerns should thus not be encoded in the language syntax, but transparently taken care of by the language's runtime environment. See: adaptive runtime.
        
* **Concurrency. For Multi-Core *and* Distributed.** using Channels like in Golang/[CSP](https://en.wikipedia.org/wiki/Communicating_sequential_processes), but asynchronous ones (see: Buffered Channels). The important point is to produce readable stack traces that exclude framework code, like CSP tends to give, since concurrency then is vastly [easier to debug](https://youtu.be/PNx9WqQ9QeA?t=770). Inspired by Golang and [CSP](https://en.wikipedia.org/wiki/Communicating_sequential_processes). Async is also important for the distributed part. Alternatively: For multi-core just use regular Channels like CSP, since it is proven, and for distributed just use the goroutines which are async.
    
    * Async: Concurrency should integrate well with the async feature of the language (see: Buffered Channels). Default should be to ship tasks off to be completed elsewhere (other thread/process/worker/server), while continuing own work in the meanwhile (fire & forget). Inspired by JS. But without fragmenting the logic into dispersed callback handlers throughout the codebase which are run at unknown points in time (as Hickey points out under the 'Buffered Channels' point elsewhere in this article. Counter inspired by JS).
        
    * Probably not implemented as an Actor Model. Since [Actors statefulness is complex](https://news.ycombinator.com/item?id=21561966). Also, since events going all over the place in a non-stateful app, is harder to reason about than stricter promise-based operations (using callbacks under-the-hood). Counter-inspired by [StimulusJS](https://news.ycombinator.com/item?id=25310766). Inspired by ReactJS.
        
    * Concurrency vs. Parallelism should be up to the runtime, not something the programmer should have to worry about. If the runtime has multiple CPU cores, then parallelize the tasks onto those cores. If the runtime only has one core to work with, then interleave the execution of the tasks concurrently on that single core.
        

# Tooling

* Small and predictable language surface: The [language should be small and easy to understand](https://youtu.be/_IgqJr8jG8M?t=238), and straightforward (homoiconic?) to target with tooling-code (transpiling, linting, type checking/inference etc.), so that it is easy for the community to implement good and diverse tooling for the language. Inspired by the goal for [Kitten](https://kittenlang.org/), and the homoiconicity of Lisp/Clojure.
    
* Fast feedback to the programmer is second top priority. Inspired by TypeScript hints, [QuokkaJS](https://quokkajs.com/) (!), Webpack Hot Reload, and Expo Live Reload.
    
* Great syntax highlighting. Counter-inspired by Clojure.

* Namespaces should be able to be reversed in the code, through a hotkey. Since presenting information general-to-specific (top-down) vs. specific-to-general (down-up) serves different uses. Top-down is often preferable when writing (accessing information), and down-up is sometimes preferable when reading (cutting to the chase). So it should be possible to swap between showing the module path to a function (like `com.some-example.my-app` in [Clojure](https://clojure.org/guides/learn/namespaces), or `Js.Array.indexOfFrom` in [ReScript](https://rescript-lang.org/docs/manual/latest/api/js/array#indexoffrom), or `ion-accordion` in [Ionic](https://ionicframework.com/docs/api/accordion)), to the inverse, placing the most specific part first (like `my-app.some-example.com` or `indexOfFrom.Array.Js` or `accordion-ion`). Because it aids readability when you are already in a context, since you then care about the most specific information first, not always having to read the path to that information. Imagine how much better [the Ionic accordion example](https://ionicframework.com/docs/api/accordion) would read if you didn't have to read the `ion-` prefix before every component (like `ion-accordion`, `ion-item` and `ion-label`), but could read/scan the code and see the most specific information first, followed by a suffix, like `accordion-ion`, `item-ion`, `label-ion`. Autocomplete should be able to work with both displays, so you can still drill top-down in the namespace (like typing `ion-`) and then have the alternatives presented.
    
* No need to manipulate data structures in the human mind. Counter-inspired by almost every language, but this problem is especially prevalent in [stack-based languages](https://wiki.c2.com/?StackBasedLanguage) like [Popr](https://hackerfoo.com/presentations/ttpl_slides.html), and to some extent also dynamic/non-typed languages. You should always be able to ***see* the data structure** the code is working on, at any given time, in the code or ideally inferred as an example alongside the code. Inspired by [Bret Victor](http://worrydream.com), and Smalltalk. Ideally with some actual example data, not only its data type. Though statically typed languages does indeed alleviate this need to some extent, since seeing the type of the data is better than nothing. Counter-inspired by dynamic languages such as Ruby and Python, but also counter-inspired by the argument/point free style often empoyed in FP. Also, it should be possible to visualise/animate an algorithm. Since ["An algorithm has to be seen to be believed"](https://www.goodreads.com/quotes/726152-an-algorithm-must-be-seen-to-be-believed), as D.E. Knuth said. It shouldn't be necessary for the programmer to take the effort to visualize it in his mind (with the error-proneness that entails). So the language should make such visualization and code-augmentation easy for tooling to support. But without being a whole isolated universe in its own right like a VM or an isolated [image](https://wiki.c2.com/?ImageBasedLanguage). Counter-inspired by Smalltalk. Some have described this as [REPL-driven-development](https://purelyfunctional.tv/lesson/what-is-repl-driven-development/), or interactive-programming. *"This leads to a substantially different experience from running a program, examining its results (or failures) and trying again. In particular, you can grow your program, with data loaded, adding features, fixing bugs, testing, in an unbroken stream."* from [Clojure.org](https://clojure.org/about/dynamic). Especially good for debugging: getting the [exact program state from loading up an image of it](https://news.ycombinator.com/item?id=23811382) that someone sent you. Inspired by Clojure. BUT it should have the ability to see the content of the data structures within your IDE, so you can stay and work, interactively, entirely within your files in your IDE (not via any kind of separate console). Inspired by [QuokkaJS](https://quokkajs.com/). The REPL-driven development approach should ideally afford simply changing code in the code editor, detecting the change, and showing the result then and there, without you having to go to back-and-forth to a separate REPL-shell and copy-pasting / retyping code. Inspired by [ClojureScript](https://youtu.be/Bs44qdAX5yo?t=533). In fact, since a program is about binding values to the symbols in your code, when running your code, the IDE, enabled by the content-addressable code feature), could replace variables in the text with their bound values, successively. Effectively animating the flow of data through your code. Without you having to go to an external context like a debug window to see the bindings.
    
    * REPL / interactive shell. Can be done even if compiled, by having an interpreter on top of a VM to the compiler.
        
* Sensible, friendly, and directly helpful error messages. Inspired by Elm.
    
* See section on 'Dynamic code re-arrangement'. This points to the **need for tooling to be able to reorder code depending on what the programmer is looking for**. Maybe instead of treating code just as text characters, *code should be able to be treated as blocks* in the IDE, as many web based publishing platforms (Medium, Authorea, Hashnode) have discovered could be a smart and powerful thing to do with text. Preferably as a plugin to the VS Code IDE or similar, so developers won't have to switch to a new IDE for this feature.
    
* **Quick to get started and produce something.** Inspired by JS. Counter-inspired by JS tooling.
    
    * Not too unfamiliar (to a large group of programmers, and to what they teach in universities). "Familiarity and a smooth upgrade path is a really big deal." [source](https://youtu.be/QyJZzq0v7Z4?t=1997)
        
* **Code-Formatter**, like [gofmt](https://go.dev/blog/gofmt), inspired by Golang. A tool to auto-format code into a standard. Since standardisation creates readability and faster onboarding of new developers. It also enables mechanical source transformation, which is crucial for language evolvability. Beautiful formatting is important. But **Consistency & Determinism &gt; Beauty**. Since even "a bad deterministic formatter is better than a non-deterministic formatter", [inspired](https://youtu.be/CTTTip7Kjao?t=11127) by Dart. Language should have a default standardized formatter, so code from a newbie and a pro looks similar, and jumping from project to project is easier and faster.
    
* **Reversible debugging / time-travel debugging (TTD)**. “Reverse debugging is the ability of a debugger to stop after a failure in a program has been observed and go back into the history of the execution to uncover the reason for the failure.” [Jakob Engblom](https://undo.io/resources/reverse-debugging-time-travel-debugging-brief-hist/). Inspired by [Elm](https://www.youtube.com/watch?v=Agu6jipKfYw). Re: Accounting for human limitations and affording the most natural way of thinking: *"The problem you are trying to fix is at the end of a trail of breadcrumbs in the program’s execution history. You know the endpoint but you need to find where the beginning is, so working backward is the logical approach."* [source](https://undo.io/resources/reverse-debugging-time-travel-debugging-brief-hist/). Should at least have this. Could be enabled by, but not necessarily need:
    
    * Reversible / invertible control flow: "A reversible programming language produces code that can be stopped at any point, reversed to any point and executed again. Every state change can be undone." [source](https://wiki.c2.com/?ReversibleProgrammingLanguage). Maybe. Might not be feasible, or desirable, when it comes down to it. Might be aided by immutability, and persistent data structures (if they are extended with history-traversal / operation logging features, in addition to structural sharing).
        
* [Serializable](https://en.wikipedia.org/wiki/Serialization): A program (with its functions!) should itself be able to easily be turned into a format that can be stored (to file, memory, buffer, DB) and transmitted over a network (to potentially be reconstructed or analyzed later), and then potentially run/re-run. Should support serializing the state of its data structures, as well. Even if they contain functions. Counter-inspired by [JS](https://github.com/tannerlinsley/react-query/discussions/988#discussioncomment-2348946). Inspired by Clojure (see section: ‘Interactive’, on hot upgrades).
    
* **Transpiler, configurable**, so it could translate between all language dialects and variations. So that the language could evolve in multiple directions, and consolidate later, without harm. The concern here is that for this to work the core language/AST may have to be the lowest common denominator to work across all those dialects, limiting how good any of the dialects could be (?).
    
    * [Homoiconicity](https://wiki.c2.com/?HomoiconicLanguages) could perhaps give affordance to such interlinguality. Inspired by Racket. Making the language homoiconic could however tie the code structure too closely to a particular data structure (e.g. a list). On one hand, limiting the diversity of data structures is sometimes seen as a good and simplifying thing (enabling program composability): *"It is better to have 100 functions operate on one data structure than to have 10 functions operate on 10 data structures."* -- Alan Perlis' in Epigrams on Programming (1982). Inspired by Clojure. But on the other hand, a diverse set of data structures are better able to accomodate different needs and [likely be more optimal/performant](https://youtu.be/GVyoCh2chEs?t=613) for their specific use cases (not necessarily the case for Clojure, for various reasons). [Mechanical sympathy](https://www.infoq.com/presentations/mechanical-sympathy/) is important, and essential for optimal performance. Furthermore, "code as data" is basically to enable code to easily be targeted by other code, something which you can achieve [by other means](https://news.ycombinator.com/item?id=6700646), such as directly manipulating the code's Abstract Syntax Tree (AST) through 'syntax objects' which have info about the relevant scope, namespace etc. (like in Racket). But there is some merit to having the data structure (syntax tree) be the very thing the programmer sees in the code, so mental transformations are reduced to a minimum when operating on it. In the end, homoiconicity may only be relevant if we want to allow for meta-programming. See section on 'meta-programming'.
        
* Editor integration: Should afford simple integration into editors/IDEs like VS Code. Typically via the Language Server Protocol ([LSP](https://microsoft.github.io/language-server-protocol/)). Inspired by [Rust](https://youtu.be/A3AdN7U24iU?t=3102). Syntax highlighting, a [language server](https://code.visualstudio.com/api/language-extensions/language-server-extension-guide) (for autocomplete, error-checking (diagnostics), jump-to-definition etc.), via the [Language Server Protocol (LSP)](https://microsoft.github.io/language-server-protocol/).
    
    * Interactive: facilitates an IDE-plugin (VS Code) that shows the contents of data structures while coding. Enable REPL'ing into a live system. Inspired by Clojure. But with some security, so that a rouge/unwitting programmer can't destroy the system / state. Counter-inspired by [Smalltalk](https://wiki.c2.com/?WhyIsSmalltalkDead). Some form of Hot Reload / Hot Upgrades at runtime, even though the language is statically typed. Perhaps by requiring that the swapped in functions must take in and return the same types as the previous version (i.e. enforced interface). Inspired by [Facebook's usage of Haskell](https://elixirforum.com/t/hot-reloading-and-static-types/18962). NB: Might conflict with compiling to WASM, since WASM gives a restricted environment. See section on WASM environment.
        
    * "Comments should be separate from code, joined at IDE or joined via manual tooling. This would allow comments to span multiple lines/function and files. IDE could also alert when breaking changes are made. Pairs well with the Content-addressable code wish." Inspired by [supermancho @ HN](https://news.ycombinator.com/user?id=Supermancho). You could also show/hide comments, and click on a particular piece of code or variable to see the comments for that. Without having to visually map references on a comment line to the actual variable, which is also prone to documentation drifting out of sync with the code it is documenting. With comments tied to content-addressable code, then when deleting/updating the code you also delete/update the comment. Renamings would be transparent and automatic, but when the code changes structurally the IDE could warn that the corresponding comment/doc needs to be updated.
        
    * The expansion of function definitions inline, on demand. "Take the definition, splice it into the call site, rename local variables to match the caller", as [JonChesterfield @ HN](https://news.ycombinator.com/user?id=JonChesterfield) said. So you don't have to jump around different files, which may get you to lose your state of programming flow. Content/code should even be editable then and there, and simply stored back to the files where they reside. Inspired by [supermancho @ HN](https://news.ycombinator.com/item?id=29730594) Lisp IDE's, and TailwindCSS. Content/code (and navigating it) should be free'd from file boundaries (see also: content-addressable code). Inspired by Git.
        
* Well-documented. Documentation on language syntax should be accessible from the editor/IDE, via. the LSP.
    
    * [Docs should be versioned](https://youtu.be/dFHj1d9FG8M?t=715), so that docs for old versions never disappear, either from the web or from the IDE integration. Inspired by ReScript, and counter-inspired by Emotion (CSS-in-JS).

    *  Comprehensive: Centralized and freely hosted repository for documentation for all libraries, so that all packages can be documented the same way. Reducing barriers to entry for authors and users. Inspired by Elixir's [HexDocs](https://hexdocs.pm/).
      - Fast and uniform way to search. Not having to rely on generic internet search engines.
      - Discovery of libraries. A centralized resource leads to more reuse of existing libraries, and can enforce some standards such as writing a "why" section first and foremost for a given library, so it's never a question about the _intended purpose_ or use case for a library would be.
      - Integration with testing: Tests should be executable directly from the documentation website, providing a practical approach to demonstrating functionality.

    * Generated docs from Markdown written directly alongside the code. For convenience and efficiency. So the docs can live and be up to date alongside the relevant code. The IDE should be able to show/hide it if it grows large. Even though the code generally should be self-documenting and newbie-readable on its own, some insight into intended use and gotchas are always helpful.

   * For new libraries, not already present in the ecosystem, the search should suggest best-in-class libraries from similar languages which could be easily be ported using ChatGPT or similar LLM AIs.

        

# Ecosystem

* The language should be MIT licensed. Permissive copyright and trademark. MIT + use however you want, just not malicious. Favorable to creators and teachers. People should be able to make paid courses. Counter-innspired by [the Rust trademark drama](https://youtu.be/9mfO821E7sE?t=1498). 

* The language should be "open to extension" by any in the community, without permission. So that it can evolve and converge to a consensus, based on real-world experience and feedback. This is mirrored in the important talk [Growing a Language, by Guy Steele](https://youtu.be/_ahvzDzKdB0?t=1330), and the point on [crucial evolvability](https://www.youtube.com/watch?v=_ahvzDzKdB0). But the culture of the language community should *not* encourage bending the language in unintended ways just for the sake of it, as staying close to the overarching general-purpose language (GPL) makes knowledge transfer/usage generally applicable across domains (being able to move between projects within the same language should *in general* be made easy), and afford a more cohesive ecosystem. Counter-inspired by [DSL](https://en.wikipedia.org/wiki/Domain-specific_language)'s (see: avoid DSL's).
    
* Optional configuration, but providing sane and conventional defaults so you can get started quickly and without worry. (Not rely solely on [convention over configuration](https://en.wikipedia.org/wiki/Convention_over_configuration) (CoC), due to potentially too much implicitness/magic. Counter-inspired by Ruby on Rails.) "if you apply \[CoC\] dogmatically you end up with an awful lot of convention that you have to keep in your head. It's always a question of balance; Hard Coding vs. Configuring vs. Convention, and it's not easy to hit the optimum (which depends on the circumstances)." as [Peer Reynders reminds us](https://dev.to/peerreynders/comment/1j4c4).
    
* It should be small, but extensible by using simple primitives (see: community grown, configurable language). Pragmatically, it should use LLVM to compile to a single binary (a standalone binary on each of the mainstream UNIX and Windows operating systems). Inspired by [Roc](https://youtu.be/vzfy4EKwG_Y?t=250) and [Golang](https://go.dev/solutions/webdev). The language should probably be built using [OCaml](https://qr.ae/pGz7Uh) (since it affords pragmatic sound static typing, and [is more approachable than Rust](https://hirrolot.github.io/posts/compiler-development-rust-or-ocaml.html)). But other candidates are [Rust](https://news.ycombinator.com/item?id=24224837)  (esp. due to availability of programmers), or [Zig](https://ziglang.org/), or [Rust for the compiler and Zig for the standard library](https://github.com/roc-lang/roc/blob/main/FAQ.md#why-does-roc-use-both-rust-and-zig) (since they afford safety and speed). Another alternative is [Racket](%5BRacket%5D(https://felleisen.org/matthias/manifesto/sec_pl-pl.html)) (since it is a Lisp geared towards creating languages), or [maybe](https://qr.ae/pGz7Og) Haskell (since it is good for working with [AST](https://en.wikipedia.org/wiki/Abstract_syntax_tree)'s). LLVM has bindings to these languages, and they are typically hailed as suitable for creating other languages. [Unison](https://www.unisonweb.org/docs/tour) could be a candidate, too, since it is Haskell-like and supports content-addressable code, but it is too early days for it yet. Available programmers (i.e. community size) in these languages should be considered (see: self-hosting). Should do more with less. Inspired by Lisp. Since predictability is good for humans reading, and for machines interpreting, and if it's predictable to machines, humans also benefit. **Important**: *"As one adds features to a language, it ramps up the complexity of the interpreter. The complexity of an analyzer rises in tandem."* - [Matt Might, on static analysis](http://matt.might.net/articles/intro-static-analysis/)
    
* Modularity. Module system which is sensible. Counter-inspired by the NodeJS controversy. Code-splittable and [tree-shakeable](https://blog.cleancoder.com/uncle-bob/2018/04/13/FPvsOO.html). Inspired by Rollup. [Function-level dead code elimination](https://elm-lang.org/news/small-assets-without-the-headache), inspired by Elm. This is possible in Elm because functions in Elm cannot be redefined or removed at runtime. This could potentially conflict with the envisioned Hot Upgrade feature inspired by Clojure (see: Interactive). This problem could perhaps be removed by disallowing modification/overloading of functions and data types in the standard library (or any 3rd party library). Alternatively: it should be possible to specify what parts of the application should be tied down and optimized (the client code), and which part should, at the potential expense of larger assets, be Hot Upgradeable (the server code).
    * First-class modules: Modules as a data structure (record of functions), that you can pass around in the program, and select and use at runtime. For increased dynamism (might be reconsidered if it compromises static analysis guarantees at compile time... like the aforementioned function-level dead code elimination). Inspired by OCaml.
    
    * [Tree-shakeable code](https://medium.com/@Rich_Harris/tree-shaking-versus-dead-code-elimination-d3765df85c80) (esp. useful for client-server webapps). So it should need a source code dependency between the calling code and the called function. Which makes the language more FP than OOP, according to one [definition of FP vs. OOP](https://blog.cleancoder.com/uncle-bob/2018/04/13/FPvsOO.html). In general, shifting concerns from runtime to compile-time is considered a good thing, as it makes the language more predictable, optimizable, and affords helpful coding tools. Having consequences of code changes appear at runtime is a bad thing (see: [The Fragile Base Class problem of OOP](https://en.wikipedia.org/wiki/Fragile_base_class)).
        
    * Explicit imports, so tree-shaking (to remove unused code) can be done. Inspired by JS. Also, so that it is clear where imported functions come from. Counter-inspired by [Golang](https://github.com/mjarkk/go-graphql/blob/e0fd37d29c6deba5ae5e059a562e765dfe608863/examples/fiber/main.go).
        
    * Standard library should even be tree-shakeable. Inspired by [Zig](https://ziglang.org/learn/why_zig_rust_d_cpp/#first-class-support-for-no-standard-library).
        
    * **Predictability**: ***Making dynamic/runtime things static/compile-time enables predictability and optimizations*** (such as tree-shaking). Inspired by ESM and counter-inspired by CJS in JavaScript (see [How does it work](https://www.codingame.com/playgrounds/7463/tree-shaking-in-javascript-with-rollup) on tree-shaking).
        
    * Not file boundary dependent. Can be split into files, but execution shouldn't be dependent on file boundaries. So the programmer is free to keep code tightly together. Inspired by SolidJS.
        
* Self-hosting: In the future, the language should *maybe* be made [self-hosting](https://github.com/nagydani/seedling/blob/master/RATIONALE.md#self-hosting), meaning it's compiler would be built in its own language. For portability and language independence. But it's more important that the language is built initially (using LLVM) to facilitate the targeted usecases (webapp + systems dev.), rather than being [implicitly optimized for writing a compiler](https://dev.to/madhadron/comment/8n52). Also: building a compiler in the language could potentially mean dealing with so many low-level concerns that the restricted and high-level nature of the language will be compromised. But then again, the language should ideally be suitable for systems development, and writing a fast compiler for itself is a good test case for that... Another important side-effect by self-hosting is that when the language is written in itself, the community is more empowered to expand the language, and not rely on others to do it for them (in another language, which they might not know themselves). This is important for a community-grown language to avoid [democracy turning into bikeshedding to death](https://news.ycombinator.com/item?id=30419531). The impetus is placed with the builders (not the vocal onlookers), and self-hosting empowers people to take matters into their own hands. Users become builders. The important part is to simplify merging of different directions, so that the language can converge. The language being about composing independent primitive abstractions should make this merging easier, since it is fewer intertwined features to [de-complect](https://github.com/matthiasn/talk-transcripts/blob/master/Hickey_Rich/SimpleMadeEasy.md) and figure out how will interact. (see: 'Community grown').
    
* **Powerful primitives over batteries-included**: Few, but powerful and composable, core primitives. Based on very few fundamental concepts to learn. Inspired by Lisp and Clojure. Prefer uniformity and consistency. Counter-inspired by JavaScript's only half-way interchangeable expressions and statements. Without feature uniformity then programmers will learn, use and prefer slightly different subsets of the language, but that leads to extensive knowledge being required to read others' code ([Farooq et al., 2014](https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0088941)). NB! But beware [Tesler's Law of conservation of complexity](https://humanist.co/blog/law-of-conservation-of-complexity/): less complex primitives would mean more complex programs (and more complexity for the programmer to write and read), since the irreducible complexity has to be accounted for somewhere. The overall goal is to eliminate [accidental complexity](https://en.wikipedia.org/wiki/No_Silver_Bullet#Summary), by a curated set of powerful abstractions.
    
    * [Levers](https://twitter.com/kentcdodds/status/1529583302713085952?s=20&t=OdKfFC0x_Tq4JwcFOq3AaQ) which give developers options for various kinds of tradeoffs. Inspired by [Remix](https://remix.run/blog/remix-and-the-edge#enter-remix). Ideally, if at all possible: an **opt-in Garbage Collector (GC)**. Maybe enabled through a modular/plugin-oriented runtime (or as an added library). So the language would be [easy to make a web API](https://macwright.com/2021/01/15/rust.html) in, since: *"Rust makes you think about dimensions of your code that matter tremendously for systems programming. It makes you think about how memory is shared or copied. It makes you think about real but unlikely corner cases and make sure that they’re handled. It helps you write code that’s incredibly efficient in every possible way. These are all valid concerns. But for most web applications, they’re not the most important concerns."* -- [Tom MacWright](https://macwright.com/2021/01/15/rust.html).
        
    * But avoid [DSL](https://en.wikipedia.org/wiki/Domain-specific_language)'s, since Domain-Specific Languages typically become mini-languages in their own right, so enabling and encouraging them can increase difficulty reading programs. Such languages are akin to dialects/sociolects that [hinder](https://news.ycombinator.com/item?id=31018833) generalised understanding and learnability (adds knowledge debt). Counter-inspired by Lisp (e.g. [Lisp being too powerful](https://wiki.c2.com/?LispIsTooPowerful) since [Lisp shepherds you into building your own language/DSL](https://news.ycombinator.com/item?id=22700512)), and stack-based languages like Factor which maybe has too powerful (re-)factoring capabilities. It might be true that *“Domain-Specific Languages are the ultimate abstractions.”*, as Paul Hudak put it in 1998. But they are only ultimate *within some particular domain*. Because [DSL's are not general and are underpowered](https://youtu.be/mVVNJKv9esE?t=1046), precisely because they are domain-specific (they sacrifice general expressivity over expressivity in one specific domain). But how do you know that you know your domain? That you have perfectly captured your domain in your DSL, and don't need to rework the DSL entirely, to account for some new understanding? Most [domains are moving targets](https://youtu.be/mVVNJKv9esE?t=1137), to some degree. Generalized languages seem a better way to go, even though they might entail slightly more work within a domain, than a DSL. (A sharp knife is in general preferable to kitchen-appliances for every single use case.) Some cross-domain terms (keywords like `function`, `if`, `return`, etc.) are usually helpful for onboarding programmers, since they afford familiar *knobs* on which to hang the other unfamiliar code. Even if you don't understand the domain (or its plethora of abstractions), you would at least understand *something*. From where you could build your further understanding.
        
    * Small focused core, with powerful composable primitives, that lends itself well to abstraction. Language extensible by library authors. Strong convention and encouragement for abstractions based on generalizable [JTBD](https://jtbd.info/2-what-is-jobs-to-be-done-jtbd-796b82081cca) naming, instead of business/domain-specific DSL's (reasoning above).
        
    * Modular composition, configurable. Inspired by [Rollup plugins](https://rollupjs.org/guide/en/#plugins-overview).
        
    * [A language for library authors](https://youtu.be/ltCgzYcpFUI?t=1317). Inspired by the success of C++. The language should be able to **evolve by community convention, not by centralised specification**: the language itself should be extensible with libraries (would probably need to have some limited metaprogramming facility in the form of compile-time macros... good idea?). See: community grown, configurable language.
        
    * **Fast branching and merging**: What would be important is to facilitate fast and simple language *merging*, due to all the community divergence and implementation branching that would appear (for the aforementioned reasons; library-driven). Inspired by Git ([fast branching and merging was the big idea behind much of Git's success](https://qr.ae/pG3XE8)). So the community is enabled to easily find back together after a split/branch (if their ideas and goals come back in alignment, and they have converged to an agreement on a new feature). See also: "forward- and backward-compatibility". A standardization process can be good for cohesion, but can also become a roadblock for progress and innovation, due to taking a long time and effectively introducing a monopoly on the mind-share (causing the majority of the community to wait for the standardization process before adopting nearly anything, instead of taking a risk). Counter-inspired by [the history of Lisp (and the ANSI standard of Common Lisp)](https://youtu.be/GVyoCh2chEs?t=402).
        
    * [Type 2 bootstrapped](https://lispcast.com/two-kinds-of-bootstrapping/), using a suitable base language that affords a small core of necessary abstractions to our language, with which the rest of the language can be built.
        
* Compilation should be able to target some popular language & ecosystem, like **transpile to JavaScript or** [**compile to WASM**](https://dev.to/taybenlor/web-assembly-should-be-a-default-binary-target-44m6), or potentially even the JVM, to get cross-platform interoperability. But not any target for any cost, if it would put unwieldy constraints on the language design. WASM seems like the best candidate. The goal of no Garbage Collector (GC) would align with targeting WASM, since WASM currently has no GC of its own, and thus it is difficult to target WASM for GC-based languages (without shipping a huge bundle to every client containing a custom GC). See [Notes on the Future of WASM and JS](https://dev.to/redbar0n/notes-on-the-future-of-wasm-and-js-4g6o). See: "No Garbage Collector". Would be open to also transpiling to Rust. Since coding in a stricter, more idiomatic single-paradigm language, which would be more beginnner-friendly than Rust, it could make systems level and performant web server programming even more accessible (see also [Smaller Rust](https://without.boats/blog/notes-on-a-smaller-rust/)). One could then leverage the Rust crate ecosystem, too. If the dream language would have no GC, a borrow-checker (and maybe even initially be written in [Rust, or maybe Ocaml instead](https://hirrolot.github.io/posts/compiler-development-rust-or-ocaml.html#final-words)), it may be possible to transpile to Rust.
    
    * Transpilation to another language should output human-readable code. So that it can be used for debugging. Counter-inspired by ClojureScript. Inspired by ReScript. The transpiled output code should also be able to be mapped/transpiled back to the original language, ideally by simple visual inspection, alternatively by tooling. So that communication with community members of the target language (e.g. JavaScript) is made easier, and debugging help in the target language can be applied back to the code in the original language.
        
    * [Escape hatches](https://youtu.be/EnPodoPzimE?t=612): The language should have escape hatches that facilitate integration with other ecosystems, to aid in rapid adoption. This could compromise the strictness and guarantees of the language, but it should be possible for those who want to take on that risk/burden. (The language runtime should give proper warnings about loss of safety guarantees, in case someone unwittingly uses third party dependencies that cause it). For them, the language's guarantees will only be as reliable as the guarantees of the older languages the language interoperates with (see 'Bindings for types' below, and also later 'Typed Holes'). Escape hatches enable "making the easy jobs easy without making the hard jobs impossible", as Larry Wall of Perl [said](https://qr.ae/pGQB5i). **In general, the language philosophy should lean towards uniformity and consistency with a small cohesive vocabulary.** For those (10% of) tasks that potentially doesn't fit well within the constraints of the language, we ideally don't want to bolt on features and impurities to the language (making it more powerful at the expense of making the language more complex, harder to learn, more footguns, less uniform/consistent). Counter-inspired by Rust. Ideally, such features should be afforded by good interop with third-party libraries written in more suitable languages.
        
    * Library compatibility tool. So you can input a list of your stack of libraries, and it will tell if and where they are incompatible. Counter-inspired by [JS Fatigue](https://medium.com/@ericclemmons/javascript-fatigue-48d4011b6fc4#.prcj59904).
        
    * Bindings for types. There should be either official bindings towards the most popular libraries/frameworks in other languages. But even better, it should be some way to automatically generate bindings. Or even better, for interop with each langauge: an official adapter that automatically translates all primitive types to default safe types in the language (for simpler transparent use).
        
* Small standard library. To have some common ground of consolidation, and to provide the basic and most common utils. So usage will be fairly standard, and coming into a new codebase not feel too foreign. But [not too big standard library](https://mkdev.me/en/posts/how-to-choose-a-programming-language), since it would be connected to language updates, which are slower, and community competition is better for adaptability over the long run.
    
    * The minimal standard library should be designed and decided by one leader with good insight into what users need, and a strong appreciation for consistency. To avoid endless bikeshedding. This is the only place where the language should have a benevolent leader for a limited time.
        
    * **Community grown** / off-hands-leadership: No [BDFL](https://en.wikipedia.org/wiki/Benevolent_dictator_for_life), since it impedes evolution & diversity. [Every top 10 programming language has a single creator](https://pldb.io/posts/aSingleCreator.html) (aka. Benevolent Dictator For Life, BDFL). But the undertaking of a programming language is a massive task, so development of it ought to be parallelized from the start, and grown by a community. For it not to take the typical 7-10 years to develop and gain adoption. Since a language is dependent on a community of speakers, it is very beneficial for it to be a community effort from the start. Even though final decisions may come down to a BDFL as the cheif designer / architect (to avoid design by committee; or a death-by-a-thousand-incoherent-compromises), disagreements should always be tried to be resolved by the community first. *"When a langauge accepts bottom-up adaptations (from the users) it will handle new topics and new problems more efficiently than when it need to wait for top-down approval of such adaptations."* (from [Will ugly languages always bury pretty ones?](https://statmodeling.stat.columbia.edu/2007/09/27/i_was_correspon/)). The language designer should more be an arbitrator in discussions the community can lean on regarding what should be the default convention. The designer(s) and stewards of the language should also be nice (so the community will be welcoming and thus flourish). Inspired by Ruby's ["Matz is nice, so we are nice"](https://learn.co/lessons/matz-readme). Even though none of this is strictly a language "feature", it is nonetheless of *major* impact to a language and its development, so it deserves a mention. Furthermore, that **all people should have actual ownership of the development of the language**, is vital for contributions and growth. The language might not grow exactly where the designer intends, but a centralizing authority (like a BDFL) may [just as well](https://lispcast.com/cognitect-clojure/) be [stifling growth](https://lukeplant.me.uk/blog/posts/why-im-leaving-elm/#leadership-style) (and [causing pain](https://www.reddit.com/r/elm/comments/81bo14/do_we_need_to_move_away_from_elm/)), as it purports to lead it. Counter-inspired by Elm. Yes, wild growth might lead to some weeds (bad dialects/libraries), but leadership through conventions and good defaults could alleviate potential analysis paralysis and decision fatigue experienced by language users. Counter-inspired by [JS fatigue](https://auth0.com/blog/how-to-manage-javascript-fatigue/). Ultimately, the power and impetus should reside with [The Man in The Arena](https://www.goodreads.com/quotes/7-it-is-not-the-critic-who-counts-not-the-man), and that man/woman should always be able to be you. **The language standard / mainstream should upstream/incorporate changes** found to be popular in the wild (amongst all the various dialects/customizations), and at the same time ensure they are incorporated well (coherently and consistently). This is opposed to initial/top-down design by committee, which often lacks vision and coherence, and pragmatic connection with the real world.
        
        * Free experimentation on branches that can be upstreamed: It is hard to predict the effect of novel language features, especially before they've been tried in the wild for some time. Languages evolving by centralized committee tend to evolve slowly, as for each new feature they have to come to a consensus, and predict and test its use. Whereas in extensible languages anyone in the community may modify it without permission, and test it on their own. This is much faster, and dialects can be tried in parallel. Then they could be upstreamed back into to the mainstream language dialect. This could be a sweet-spot.
            
        * How could the language be **very constrained** while at the same time be **community grown**? The language core should be very constrained around composition of a few core primitives (self-hosting), but it could be modified or built upon by others. So that it could evolve in multiple avenues of exploration, and gain from the competition. Where it would be up to the community to decide whether they want to use the constrained version(s) (suitable for large scale complex environments), which I prefer, or the bring-your-own syntax version(s) (suitable for small scale playful experimentation and research) which would inevitably appear. Inspirations here would be Lisp, Clojure and Racket.
            
* Package manager and build system. For installing, upgrading, and configuring, as well as building, compiling, and distributing code written in the language. Inspired by [Cargo](https://doc.rust-lang.org/cargo/) for Rust.
  - Package managers should be separate from the core runtime. So alternate package managers could be developed (for performance or other reasons) by the community, and versioned and published independently. Inspired by [the Node NPM debacle](https://socket.dev/blog/node-community-debates-enabling-corepack-unbundling-npm).
  - The core runtime should be possible to download with or without a compatible default package manager. For ease of installation and use, while allowing flexibility of choice.
    
* Single package directory: Some sort of singular reference to a library package information service. So the community can organise around one common point, instead of scattering. Inspired by NPM. But doesn't necessarily need to be centralised package download/storage, the storage/download could be decentralised. But would need to be safe. Cert signing?
    
* Runtime environment: Be able to run on some existing popular cross-platform runtime (like WASM, or maybe the JVM?). Inspired by Clojure. And/Or have a very minimal programming language runtime (without a GC). Inspired by Rust. But the runtime should in any case handle the scheduling of goroutines, inspired by Golang.
    
* **Ecosystem: Interoperable** with one or more existing programming language ecosystems. To import or reuse libraries. Without too much ceremony. So the ecosystem doesn't have to start from scratch. Counter-inspired by [Elm](https://guide.elm-lang.org/interop/limits.html). *Smooth interoperability with existing ecosystems and other systems, minimising glue code, is one of the largest underestimated features of a language, in terms of enabling its success*. Inspired by [C](https://www.scattered-thoughts.net/writing/against-sql/#non-porous). While a fully integrated system [can be very nice](https://youtu.be/nSrucNcwlA8?t=1114), it inevitably risks being disrupted by a thousand small cuts (i.e. are made irrelevant to a project because other tools/services outperform them on one or two critical features, or needs interop). Counter-inspired by Ruby on Rails, [Lambdera](https://youtu.be/nSrucNcwlA8?t=1114), [Elm](https://gist.github.com/Rich-Harris/0f910048478c2a6505d1c32185b61934) and [Dart](https://youtu.be/dFHj1d9FG8M?t=911). The world is heterogenous, and no single system yet has been able to solve all relevant problems for all people. Many have tried to [own the world](https://gist.github.com/Rich-Harris/0f910048478c2a6505d1c32185b61934), like Smalltalk, Imba, Darklang, etc., but this can be an impediment to mass adoption. A language as a small focused tool which lives well in a heterogenous environment is the way to go.
    
    * The language should [be a good citizen](https://youtu.be/_IgqJr8jG8M?t=285), and have a good [Foreign-Function Interface](https://en.wikipedia.org/wiki/Foreign_function_interface) (FFI), so that it can *use libraries* written in other languages, or be *embedded into* apps written in other languages, or *interact with distributed services* in other languages. Being able to **adopt the language alongside an existing software stack** is very important. Inspired by Kitten and JavaScript. Should [not assume the language is the main language](https://youtu.be/_IgqJr8jG8M?t=301) you're using. Inspired by Kitten. Counter-inspired by C# and Java.
        
    * C ABI: Compatible with the [C language Application Binary Interface (ABI)](https://youtu.be/Gv2I7qTux7g?t=175). So code in the language is usable from other languages. Inspired by Zig. Since compiling to WASM is desirable, [WASM's C ABI](https://github.com/WebAssembly/tool-conventions/blob/main/BasicCABI.md) could probably be used, instead of a separate implementation towards the C ABI.
        
    * "[WebAssembly](https://webassembly.org/) \[WASM\] describes a memory-safe, sandboxed execution environment" where [WASM's security guarantees](https://webassembly.org/docs/security/) eliminates "dangerous features from its execution semantics, while maintaining compatibility with programs written for C/C++." NB: But WASM's restrictions *might* conflict with runtime dynamism and the desired live REPL feature (inspired by Lisp/Clojure)...? "Since compiled code is immutable and not observable at runtime, WebAssembly programs are protected from control flow hijacking \[code injection\] attacks."
        
* Open-source, team: Developed as open-source from the start, of course. By more than 1 hero programmer (see: [bus factor](https://en.wikipedia.org/wiki/Bus_factor)). Preferably by 4-5 people collaborating and to some minimum extent overlapping.
    
    * [Big decisions via public RFC's](https://youtu.be/A3AdN7U24iU?t=2500) (Request For Comments).
        

# Sobering notion

* All the while, the language should avoid the [fate of the Vasa](https://www.youtube.com/watch?v=ltCgzYcpFUI).😂 Which means a feature creep resistant *core language*. (I am aware the irony of this feature list, but read on...) So the feature set should be designed and decided upon as early as possible (when the degrees of freedom in the design space is as wide as possible), with a holistic view. Boring &gt; clever. Designed to reach a 80% [sweet spot of most important features](https://youtu.be/ltCgzYcpFUI?t=2244), [foregoing the most exotic and esoteric features](https://www.progsbase.com/featuredpost/language-features-vs-usefulness-and-understandability/), and foregoing the ability to solve edge-cases (such should be relegated to interoperability with other more specialized programming languages). Since 80% of the work and complexity would come from the last 20% ([The Pareto Principle](https://www.investopedia.com/terms/1/80-20-rule.asp)). This might include foregoing some of the more esoteric or novel features (see the summary for those). The language designer(s) should actively work to make it smaller, and more elegant, not bloat the syntax with every new feature. Counter-inspired by C++.
    
    * **Not multi-paradigm**: The language should not attempt to be multi-paradigm, but rather be holistically and uniformly designed around a single big vision from the start. Because multi-paradigm languages often have many warts and unintended consequences (as a result of the interaction between the paradigms; mixed metaphors make for confused thinking), and makes the experience using the language less coherent and less predictable (when moving from one codebase/project to another). A language catering exclusively for its own idioms would make it more cohesive and give a more predictable experience. Predictability is key in programming. A great deal of complexity in programming and programming languages today seem to be accidental rather than essential. We create bugs in our systems because we don't really understand them, and we don't understand them because they are so multi-faceted and [complected](https://github.com/matthiasn/talk-transcripts/blob/master/Hickey_Rich/SimpleMadeEasy.md), and thus we aren't able to easily reason about them. A small [meta-language](https://youtu.be/18F5v1diO_A?t=204) is also important, so most things afforded by the language should be self-explaining within its own idioms, and those idioms should be close to the natural world and most natural languages (see 'SVO syntax'). The focus of the language should be on onboarding complete beginners, not catering to some existing programming language community (which would likely experience an [Uncanny Valley](https://en.wikipedia.org/wiki/Uncanny_valley) / misleading familiarity anyways). Existing programmers would also be able to quickly learn, if a transition guide is made (maybe using ChatGPT or [RosettaCode](https://rosettacode.org/wiki/Rosetta_Code) or something). It's the complete beginners that usually present the greatest challenge to onboard.
        
* *"Are you quite sure that all those bells and whistles, all those wonderful facilities of your so-called 'powerful' programming languages belong to the solution set rather than to the problem set?"* — Edsger W. Dijkstra
    
* *"In anything at all, perfection is finally attained not when there is no longer anything to add, but when there is no longer anything to take away"* -- [Antoine de Saint-Exupéry](https://english.stackexchange.com/a/38838/416201) (Thanks for the reminder in your comment on the [first draft](https://dev.to/redbar0n/features-of-a-dream-programming-language-cio/), Costin Manda.)
    
* *"Inside every big ugly language there is a small beautiful language trying to come out."* -- [sinelaw](https://github.com/sinelaw/infernu)
    

# Future reference / reading

* (For future reference/reading: Some more lists of potentially important features, by: [Animats](https://news.ycombinator.com/item?id=29731425), [ModernMech](https://news.ycombinator.com/item?id=30489515), [Don Syme of F#](https://youtu.be/1AZA1zoP-II?t=2722), [Bagel's niceties](https://www.brandons.me/blog/the-bagel-language#misc-niceties), [IdealProgrammingLanguage](https://wiki.c2.com/?IdealProgrammingLanguage), [The Hundred-Year Language](http://www.paulgraham.com/hundred.html) (by Paul Graham), [Notes on a smaller Rust](https://without.boats/blog/notes-on-a-smaller-rust/), [Revisiting a 'smaller Rust'](https://without.boats/blog/revisiting-a-smaller-rust/)) (new PL design rationale), [Why async Rust?](https://without.boats/blog/why-async-rust/) (design decisions esp. vs. Golang's green threads), [The Rust I Wanted Had No Future](https://graydon2.dreamwidth.org/307291.html) by it's designer Graydon Hoare, [Roc FAQ](https://github.com/roc-lang/roc/blob/main/FAQ.md) (with Roc's eloquently reasoned language design decisions), and Dmitrii Kovanikov' opinion on [Fundamental language features enough to be productive](https://twitter.com/ChShersh/status/1730609197824217200).
    

# The Hairy Vision

The vision is to reduce complexity for app developers, through abstraction and wise platform defaults. I'll try to paint a picture of the overarching vision, even though I know it is a bit hairy.

The vision ties back to the principle that:

* A language determines **WHAT** you can & have to think about, but also **HOW** you have to think about it.
    

And the desired features that the language should be:

* Designed for fast onboarding of complete beginners (as opposed to catering to a specific language community who already have the [curse of expertise](https://en.wikipedia.org/wiki/Curse_of_knowledge)).
    
* Very high level. Abstract as much of the details as possible. (Abstraction means to "draw away" the concrete nature of things, so that their commonalities remain.)
    
* Have a small [Meta-Language](https://youtu.be/18F5v1diO_A?t=204). For onboarding with low overhead. Counter-inspired by [BuckleScript](https://rescript-lang.org/blog/bucklescript-is-rebranding#community-situation).
    
* Simple, with a well thought out vocabulary. Inspired by Clojure (except `cons` and `conj`, which are too similar-looking).
    

Most languages presume the app developer will deal with a lot of relatively low level concerns, to get pretty obvious benefits we *should* be able to take for granted (e.g. concurrency and parallelism). The sentiment ["I don't know, I don't wanna know"](https://youtu.be/LKtk3HCgTa8?t=3017), as Rich Hickey put it, applies to this. However, it does not mean hostility towards learning, but a certain amount of healthy scepticism: if you have to document something to a large degree, have you really simplified it enough? (see: [meta-language](https://youtu.be/18F5v1diO_A?t=204)) *"Everything should be made as simple as possible, but not simpler."*, accordig to [Occam, Sessions, and Einstein](https://quoteinvestigator.com/2011/05/13/einstein-simple/). We know that even [too much documentation](https://rescript-lang.org/blog/bucklescript-is-rebranding#community-situation) (i.e. meta-language) is a code smell, since code should be self-documenting. A language's complexity consist of it's syntax and semantics, but also its [meta-language](https://youtu.be/18F5v1diO_A?t=204) (which should be minimised). A language should not burden the speaker/thinker with unnecessary complexity, as that cognitive effort is better spent on the task at hand: the domain is often complex enough in itself! We [shouldn't invent problems to solve](https://news.ycombinator.com/item?id=17905267), even if the solutions could be beautiful.

Here is the start of a non-exhaustive list of what the application developer *should* and *should not* have to be concerned with. I.e. what the language should afford as syntax and semantics when I'm coding (which does not exclude how the language libraries/runtime implements it under-the-hood):

| What I want to think about: | I [don't want to know](https://youtu.be/LKtk3HCgTa8?t=3017) or think about: |
| --- | --- |
| Splitting up the problem/data into [separate pieces](https://en.wikipedia.org/wiki/Data_parallelism#Data_parallelism_vs._task_parallelism). | Concurrency vs. Parallelism, explicit parallelism constructs, goroutines, threads, Fibers, Actors, Channels, processes, CPU cores, Microservices, Distributed system topology, Mutexes, Locking, ... |
| Function composition. | Monads, Monoids, Class structure, Contextual precoditions, Inheritance rules, Type / Category Theory, ... |
| Choosing appropriate algorithms and data structures. | Immutability, Mutable vs. immutable references, Pointers, State management, Data-flow architecture, Complex types, type inference/conversion, ... |
| Expressing what should go together, co-location of code. | Pointers, Memory management, Stack vs. Heap allocation, Fundamental security measures, Sandboxing, Scopes, Closures, ... |
| How to organize code to communicate the ideas better to the reader, how to conform to conventions. | Performance, [Syntax/keywords](https://youtu.be/1AZA1zoP-II?t=2722), [Esoteric operators](https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/symbol-and-operator-reference/), ... |
| WHAT should be done, and to a limited extent also HOW it should be done | WHEN it should be done (sync vs. async, eager vs. lazy). WHERE it should be done (runtime environment-concerns, but also if the work should be done on another CPU-core or another machine) ... |
| The User Experience (UX) and the actual problem domain! | Anything that detracts my thoughts from the UX and the actual problem domain. (everything above in this column) |
| ... | ... |

**You should simply be able to describe to the machine what the problem looks like, how it could be divided up, and how (the algorithm) to solve it.** Then the machine (i.e. language runtime) should decide *when* and *where* it wants to solve it (based on it's hardware/environmental constraints): whether it means to single- or multi-thread parts of the work, or, in case the local resources are/become strained, if it should distribute the work over multiple machines (depending on the measured latency of their inter-network connection). So the language should have an **adaptive runtime**, but in lieu of that, it should at least have a platform-configurable compiler, that could make some generally and universally applied decisions based on configuration of specific platform constraints.

I want a *capable* tool, so I can write *lean* programs. Lean, as in: not loaded with what *ought to be* low-level concerns. Actually, I'd prefer the language to afford a set of powerful primitives, and the capabilities (i.e. more powerful abstractions) could just as well be in libraries than embedded in the language runtime/platform. As long as I don't have to seek out and configure all of those myself (re: [JS Fatigue](https://medium.com/@ericclemmons/javascript-fatigue-48d4011b6fc4#.prcj59904)), but could import a curated set of sane conventional defaults.

# The End

One or more of these requirements might be conflicting / mutually exclusive. Maybe. But maybe not?

One can always dream.

This is a list of my preferences. Some would probably be quite controversial. Like my aversion to certain features which a lot of other people like (e.g. meta-programming). I might just not be familiar enough with them to have developed an appreciation for them.

I will try to keep this list updated if and when I change my mind on any point, which I am open to doing. I have already changed my mind from negative to positive on generics and pattern-matching.

**What features would your dream programming language have (or don't have)?**