logoalt Hacker News

kccqzytoday at 6:48 PM1 replyview on HN

Types and Programming Languages (TAPL) by Benjamin C. Pierce. Basically IMO the main differentiator between languages is their type system. It’s basically table stakes now for programming languages to provide generics so users can write their own type-safe containers, and one simply cannot implement this without some theoretical background like TAPL.

In contrast you can easily skim Chapter 7, Semantic Analysis and realize this book gives extremely rudimentary information on type systems. Even if you were to design a dynamically typed language, this book doesn’t cover user-defined structs let alone modern essentials like user-defined sum types or closures.


Replies

conartist6today at 7:21 PM

Programming language design is way weirder than any textbook would make you think.

For example, the first rule of language design is: "Sandwich Helix." https://xkcd.com/3003/

You'll also want to study how human language evolves, e.g. through "vernacularization," which is the laziness that drives people to create short words and phrases for ideas they need to communicate often.

You'll want to learn about the differing purposes of formal and informal constructions, and about why and how meaning itself drifts with time.

You'll want to learn why "DSL" is a nonsense word and what it means for a language to be embedded in more than one domain (e.g. English is both spoken and written).

Even a simpler discipline like API design will be incredibly enlightening. How do you get users to upgrade from an old version of your API to a new version? You need to learn how to guide people towards behaving how you want without any kind of coercion: the only power you have is the power to offer incentives. Can you figure out how to create a stable equilibrium of social behavior out of dreamed-up nonsense? If you remember nothing else remember this: every language design decision that now seems inevitable and set in stone, once seemed completely, pointlessly arbitrary. Survivorship bias is very tricky to reason about! Every attempt to create a language is "creating a 15th standard" (https://xkcd.com/927/), but you have to remember that that doesn't mean that it will fail. Every language that has ever succeeded has passed through this seemingly-impassable gate!

show 1 reply