Loses Bart Massey 2012-06-23 "[PASCAL] is not my favorite language for system programming, but it has become a 'second language' for so many programmers that it provides an exceptionally effective medium of communication." --Donald Knuth Popular vs Good PLs "[...] the perpetuation of worse programming languages, once they become popular, are argued for and acted on stridently." --Richard Gabriel * Top popularity: Java, C, C++, C#, Python, relics [FORTRAN, Cobol, BASIC] * My favorites: Inform 7, Haskell, Nickle, Java, UNIX scripting * Others' favorites: LISP, Smalltalk, Prolog, Perl, Ruby Language Diversity "Go to, let us go down, and there confound their language [...]" --Genesis 11:7 * Before 1990: * Many languages, but one dominant language at a time. * Limited by implementation difficulty, machine performance. * 1990-2000: * Fairly narrow monoculture: C/C++ * Limited by MS Windows compilers, OS * 2000-present: * Explosion of languages, both ancient and new. * Limited only by attention. PL Discernment "Finally, programmers may simply differ in their tastes: they may be accustomed to discussing problems and expressing them in a particular language." -- Wikipedia: Programming Languages * Set the bar for language designers * Coping skills for failed languages * Decreased language bigotry = work together * Increased pseudocode and analysis = less "programming" "General-Purpose" PL Principles "If builders built buildings the way programmers wrote programs, the first woodpecker that came along would destroy civilization." --attr. Gerald Weinberg * Mistakes caught and reported early * Failure reports clear * Reading and arithmetic skills transfer * Previous PL skills transfer * Modularity support * Repeatable and predictable * Automates simple, tedious and error-prone tasks Purity Test Your Favorite PL "For most purity tests, lower scores denote more 'experience' of the test material." --Eric Lechner * Definedness * Reading / Writing * Arithmetic * Arrays * Units and Modules * FFI * "Standard Errors" Definedness "GCC 1.17, upon finding a #pragma directive, would instead attempt to launch commonly distributed Unix games such as NetHack and Rogue [...]" --Wikipedia: Undefined behavior * Is the PL well-defined? * Does it have a formal specification [-20]? * An informal specification [-10]? * Are there deliberately undefined behaviors [10]? * Is there widespread agreement among implementors and users on the specification's meaning [-5]? Reading / Writing "A fish won't do anything but swim in a brook He can't write his name or read a book" -- Johnny Burke, "Swinging on a Star" * Does the PL leverage our 20+ years of training in reading/writing English? * Left-to-right, top-to-bottom [5]? * Whitespace-separated words [5 for required, 1 for optional]? * Punctuation as punctuation [3]? * Useful redundancy [3]? Arithmetic "There are 10 kinds of people: those who understand binary and those who don't." --Anonymous * Does the PL leverage our 15+ years training in basic arithmetic and simple algebra? * Are numeric constants "bare" and "computer standard" [5]? * Are standard numeric operators standard [3]? * Is unary minus handled reasonably [2]? * Is "computer standard MDAS" honored [5]? * Are side-effects left-to-right in expressions [3]? * Does the PL compute arithmetic at the HS level? * Are "Single-precision", "short", etc present [-3]? * Are arbitrary-precision integers available (in PL) [10]? * Are arbitrary-precision rationals available (in PL) [10]? * Are arbitrary/settable precision floats available (in PL) [10]? * Are underflows and overflows caught at runtime [5]? * Are expression evaluations error-preserving [5]? Arrays "I realized that someone had broken in the night before and replaced everything in my apartment with an exact replica." --Steven Wright * This is the oldest PL data structure: Does the PL support it properly? * Are arrays (*not* array references) first-class? * Can arrays be copied by assignment [2]? * Can arrays be compared by built-in operators [3]? * Can arrays be passed and returned [1]? * Can arrays be stored in other data structures (esp arrays) [2]? * Are there array literals with given initializers [5]? * Are there array literals with default initializers [4]? * Are there multi-dimensional arrays or arrays of arrays or both? * If yes, answer above questions again for these * Are there built-in arrays that are dynamically resizable [5]? * Are uninited array elements handled sensibly [1]? Units and Modules "A well-defined segmentation of the project effort ensures system modularity." --David Parnas * Does the PL support referential transparency at (at least) the unit level? * Does the language have static scope [2]? Really [5]? * Does the language have a declaration mechanism that supports "free variables" [5]? * Are scope and lifetime separate concepts [10]? * Can the PL be used for building and maintaining larger-than-toy programs? * Does the PL even *have* a module system [5]? * Is the module system by convention only [-2]? * Does the PL support sensible namespacing [3]? * Does the PL support module signatures [10]? * If compiled, does the PL support separate compilation of modules [3]? FFI "'My hovercraft is full of eels.'" --Monty Python * Does the PL interact sensibly with outside code? * Is there an FFI [10]? * Is FFI painful to build "by hand" [-3]? * Does FFI take advantage of information on both sides to generate / check for correct code [5]? * Are there often substantial performance penalties for FFI [-1]? * Does the PL let outside code interact sensibly with it? * Can you call routines written in the PL from elsewhere [5]? * Does outside code need to invoke a "magic runtime" [-2]? * Can you build "shared libraries" in the PL [5]? "Standard Errors" "Pascal, in common with most other Algol-inspired languages, uses the semicolon as a statement separator rather than a terminator (as it is in PL/I and C)." --Brian Kernighan * Does the PL have well-known hazards? * Does the PL have well-known error-prone syntax [-10]? * Does the PL inspire frequent errors that could easily be caught at compile time, but are not [-20]? * Does the PL inspire frequent errors that could easily be caught at runtime, but are not [-5]? * Does the PL violate the "principle of least surprise" in obvious ways [-20]? * Is it difficult to estimate the performance of code written in the PL? * Are there large, surprising constant factors [-5]? * Are there surprising or unspecified big-O behaviors [-10]? * Can a reasonable static upper-bound on performance of a given simple program be estimated [5]? Scoring: 140+: Either you're cheating, or I want what you're programming in. 100-140: It's a real PL. But it still kind of loses. 50-100: Uggh. Here's a nickel, kid. Buy yourself a better PL. Below 50: Your PL is an abomination. Get a better one. Conclusion: No Controversy Needed "Sayre's Law: In any dispute the intensity of feeling is inversely proportional to the value of the issues at stake." --Charles Philip Issawi * I was voted "Most Opinionated (Male)" in my HS class. I have a lot of controversial opinions on PLs. I've tried not to share those today. * Sticking to pretty uncontroversial analysis is plenty to seriously impugn existing PLs: even when confining oneself to the "easy-to-fix"category. * Hopefully have hit some of my goals: * Set the bar for language designers * Coping skills for failed languages * Decreased language bigotry = work together * Increased pseudocode and analysis = less "programming"