HN
Today

Curly braces: An evolution of Unix and C

This article meticulously traces the curious history of curly braces in UNIX and C, revealing how early hardware limitations, like the Teletype Model 33's ASCII set, fundamentally shaped programming language syntax. It's a fascinating deep dive into computing archaeology, illustrating the profound and lasting impact of seemingly minor technical constraints on today's software landscape. HN readers appreciate such detailed historical explorations of foundational tech.

12
Score
2
Comments
#17
Highest Rank
4h
on Front Page
First Seen
May 24, 4:00 PM
Last Seen
May 24, 7:00 PM
Rank Over Time
18171719

The Lowdown

The article delves into the unexpected historical constraints that shaped fundamental aspects of programming languages and operating systems, specifically focusing on the curly brace ({}) in C and UNIX. It traces the evolution of how these crucial syntax elements were handled, from hardware limitations to language design choices.

  • Teletype Model 33 Limitations: The initial ASCII 1963 standard and the widely adopted Teletype Model 33 teleprinter famously lacked curly braces, lowercase letters, and other common symbols, posing an early challenge for C and UNIX developers.
  • Trigraphs and Digraphs: To support character sets without braces, C89 introduced trigraphs (e.g., ??< for {), followed by the slightly more readable digraphs in C95 (e.g., <% for {), though these solutions emerged long after the Model 33's prominence.
  • UNIX V4 Terminal Driver Solution: In the early 1970s, UNIX V4 addressed the Model 33's limitations by implementing a terminal driver that transparently translated \( and \) into { and } respectively, allowing C programs to use standard brace syntax.
  • Evolution of C Syntax: The article details how C and its predecessor B handled block delimiters, noting a brief period in early C (around nsys in August 1973) where structs could use parentheses instead of braces, and the transition from char argv[][] to char *argv[] for pointer types.
  • Pre-C Languages (B and BCPL): The narrative explores B, Ken Thompson's simplified version of BCPL, showing how it incorporated braces or their escapes ($(, $)) and its subsequent evolution into C driven by PDP-11 architecture changes.
  • Teletype Model 37 Impact: The introduction of the Teletype Model 37, which supported the full, modern ASCII character set, allowed programmers to directly use curly braces, gradually eliminating the need for terminal driver translations or language-specific escapes.
  • Lasting Legacy: The character set limitations of the Teletype Model 33 and other early design decisions continue to influence modern computing, evidenced by UNIX's prevalent use of lowercase, the concise naming conventions in libc, and the fundamental syntax of C.

This detailed historical account highlights the often-overlooked hardware and software co-evolution that shaped foundational technologies, demonstrating how seemingly minor limitations had profound and lasting impacts on programming paradigms and system design.