Everything2
Near Matches
Ignore Exact
Full Text
Everything2

Curly brace family of programming languages

created by StrawberryFrog

(idea) by StrawberryFrog (16.3 hr) (print)   ?   (I like it!) 1 C! Sat Apr 26 2003 at 12:46:07

The curly brace family of computer programming languages are a number of programming languages that share superficial syntactic similarities, including:
  • curly braces '{' and '}' to delimit code blocks.
  • == for equality test, and = for assignment.
  • semicolon as statement delimiter, i.e. a semicolon after each statement.
  • Case sensitivity.
  • lexical scope in most cases. Perl breaks this, partly.
  • Most of them (Perl excluded) insist on empty braces for function calls that take no parameters.
  • Often other C-style control structures such as for loops and increments. e.g.
    int x;
    for(x = 0; x < 10; x++) { DoSomeOperation(); }
These features surfaced in the C programming language in 1971, though its predecessors BCPL and B show many of them.

This syntax has some merits: it is terse yet readable. But this alone cannot explain its position. The rest is down to history.

C became popular, then C++ became popular as it was "a better C". Java and Perl would not have used this syntax if it wasn't for C and C++, and the rest followed that trend. This positive feedback effect has made the curly brace style the most common syntax.

The best known curly brace languages are C, C++, Objective-C, Java, C#, PHP, JavaScript, Perl. These languages differ widely in how they actually work, but the superficially similar syntax is chosen in new languages for reasons of simple familiarity.

Most of these languages are procedural and/or object-oriented. Some are strongly typed (e.g. Java), some are weakly typed (e.g. PHP).

The code

if (x == 2)
{
  y = 3;
  DoSomeOperation();
}
... could be from any of these languages except Perl or PHP. These would require the minor change of a $ sign before the variable names x and y.

Another style is the pascal family of languages, which delimit blocks with begin and end, among other minor differences. Although there are IMHO better criteria on which to divide up programming language families than on the spelling of certain textual tokens, it seems to be a good indicator of underlying heritage in this case.

Another popular language outside of the curly brace family is python, which uses white space to delimit blocks.


Inspired by the equivalent writeup on wikipedia.

printable version
chaos

One True Brace LISP BCPL When to use a semicolon in Pascal
Learn C, you hippies differences between Sunnis and Shiites Brace Wikipedia
Differences between C and Borland Delphi Software is free speech lexical scope Pascal
Female programming lacks quality Case Sensitive Objective-C White space
weakly typed Perl == semicolon
The importance of C packaging that makes you instantly suspicious B PHP
Y'know, if you log in, you can write something here, or contact authors directly on the site. Create a New User if you don't already have an account.
  Epicenter
Login
Password

password reminder
register

Everything2 Help

Cool Staff Picks
Things you could have written:
Godspeed You Black Emperor!
Indian Recipes
Kurt Vonnegut, Jr.
Costa Rica
Language is like a river
Thanksgiving, suicide, and the breakdown of an already dysfunctional family
Pentagram
My small mark on the world
Platonism
Madeleine L'Engle
Zora Neale Hurston
The humiliation of Richard Nequell
A Letter To My Grandfather
New Writeups
Tildeee
IANAL(idea)
antigravpussy
One fly amongst many(person)
sam512
Moon Base Shackleton, 1978(fiction)
Pavlovna
toy boy(person)
XWiz
tear jerker(review)
Heitah
Anarchy is Order(idea)
jessicaj
July 26, 2008(dream)
Berek
ABBA(person)
devolution
k-hole(place)
Nadine_2
The Sound Of Madness(review)
SwimmingMonkey
Conversations with Fo Fo, the Loneliest dog in Purgatory(fiction)
locke baron
lynx(thing)
Simulacron3
Reality, Dimensions and the Natural Ontology(essay)
SubSane
Making Love to a 9-Foot Woman(person)
Ouzo
Thoughts(idea)
E2 is a by-product of the existence of The Everything Development Company