3 ms·
> "Constraints provide freedom" is a nice saying but I think it's commonly applied to forms like poetry or sculpture. Just like natural language can be used to
by catnaroek 10y ago
> "Constraints provide freedom" is a nice saying but I think it's commonly applied to forms like poetry or sculpture.
Just like natural language can be used to write anything from poetry to shopping lists or even hate mail, programming languages can be used to write anything from beautiful code (say, a concisely expressed implementation of a nontrivial algorithm, based on a deep insight on the programmer's part) to mundane automation scripts or even spam bots and viruses.
> Unlike the discipline of creating a sonnet, virtually all modern programming languages provide few constraints on the form as a whole compared to the requirements of poems or realistic sculpture (whatever local hurdles they might involve)
I've found something very analogous to the discipline of writing a sonnet: writing programs where no single code path can fail. Where every single instruction or expression can be legitimately reached, and thus there is no need to throw exceptions or return error codes. For me, this is a form of art: the art of not branching more than it's necessary to. It requires a sense of aesthetics and an expressive technique far superior to those of most programmers, where the latter can be considered analogous to the native speakers of a natural language in which poetry is written.
> remember the old saying: "A Real Programmer can write FORTRAN programs in any language".
I'd love to see a Real Programmer write FORTRAN programs in Prolog, before yelling at the nearest person in frustration.
> Essentially a language is a generative, infinitely extensible tool.
Obviously, every general-purpose language lets you extend the universe of programs that exist. But relatively few languages let you extend the language itself, and even fewer do so in a disciplined way:
(0) Famously, Lisp and its derivatives let you define custom language constructs by essentially compiling them into Lisp using macros. Among the derivatives, particularly notable is Racket, which offers sophisticated ways to pattern match on syntax (objects).
(1) ML doesn't let you define new language constructs, but it lets you define abstract data types (not to be confused with abstract classes) whose internal representation isn't visible to its users, thus behaving as if they were primitive types.