3 ms·
> And why hasn’t the C world turned into a similar Tower of Babel? Because it's much harder to produce a variant of C than it is to produce a variant of Lisp.
by lisper 11y ago
> And why hasn’t the C world turned into a similar Tower of Babel?
Because it's much harder to produce a variant of C than it is to produce a variant of Lisp. Producing a variant of Lisp in Lisp (a.k.a. writing a macro) is a trivial exercise that anyone can do in a matter of minutes. Producing a variant of Lisp from scratch is an elementary exercise that an undergrad can do in a couple of hours. Producing a variant of C is an advanced exercise that would take even the most skilled programmer many days.
- tormeh 11y ago... Because so many languages are made in a matter of hours or days. Can we please drop the machismo? Making a language takes about a decade, with multiple people involved. A prototype one without a library can be made in a matter of months, but nobody would want to use those. I find it plausible that making a lisp is easier, especially if it's interpreted, but it's not that easy.
- mlieberman85 11y agoI think you misunderstood. A dialect of lisp is a fairly trivial exercise. We were able to do it in a single lecture back in college. Now that dialect had trivial and essentially useless functionality but allowed us to easily build on and create new languages, but lisp was designed to allow for these dialects to be made and to be made easily.
- tormeh 11y agoDid you make an interpreter in one lecture? Or did you just add a new macro to an existing language? S-expressions are tidy, tidy things, but just the underlying tech used to build a lexer, parser and interpreter takes a good while to understand, much less learn to write that quickly. Lisper just reminded me of some HN commenter who once wrote that "any idiot can build Youtube, it's making it scale that's hard", and that guy gets on my nerves. Sorry about projecting that onto lisper.
- nickpsecurity 11y agoThere's tutorials to manually or automatically derive parsers for whatever you can clearly define. LISP's syntax makes this trivial. From there, you just need a few functions and tree operations for interpreting/compiling. LISP is designed for tree operations with tutorials and code for those. From there, a GC and I/O with many examples in papers and on the web with doc's plus code. Additionally, there's a ton of LISP/Scheme interpreters to draw on. Hard to imagine an easier one to interpret. Compiling isn't that difficult if you target C as it basically takes two techniques. Takes a few more to target native and you don't get that in 90 minutes like one Scheme-to-C compiler presentation. What is your counter-example in terms of mainstream languages that's easier to lex, parse, interpret, compile, or link than LISP? Or even as easy? Even Wirth's languages are more complex and difficult to compile despite being brilliantly simple.
- tormeh 11y agoOh, I do agree Lisp is the simplest. No contest there. Hm, I guess it may be because building a new language (with some interesting properties) was my master thesis and it was really unpleasant. I guess I am reluctant to realize how much easier it would have been with a lisp.
- nickpsecurity 11y agoThat's a fair point. It's never easy and I had that rough experience, too. I mean, I wasn't a real expert on these things so mine was a reimplementation of existing work but still hard. Curious, what was your language's interesting properties? "I guess I am reluctant to realize how much easier it would have been with a lisp." It might help if you see a modern example. The recent language impressing me the most with its features is Julia: http://julialang.org/ http://julialang.org/ Wondering aloud about how they pulled all that off, esp macro's, led someone here to tell me it's actually femtolisp internally: https://github.com/JeffBezanson/femtolisp https://github.com/JeffBezanson/femtolisp So, they appear to have built a simple LISP, then used it to incrementally build a compiler for a complex language. They just represent the syntax internally in a LISP form and work with it from there. Don't know much more than that but it shows the power of the concept. Better demo is the one below as it goes step-by-step in stages. One commenter (Orion63) pointed out the author was re-using the proven cheat: "build a LISP, do it all in LISP, profit." Haha. I've considered duplicating that work with different language options. https://news.ycombinator.com/item?id=9699065 https://news.ycombinator.com/item?id=9699065
- nickpsecurity 11y agoAs a personal exercise, you should compare making a LISP interpreter or compiler to Wirth's treatment on doing an imperative language sometime. The difference is a 100-200 pages of work. Plus, the LISP can self-modify during compile to add any subsequent feature. It's not machismo: it's just the design of LISP. Easy to parse, easy to modify, easy to evaluate, data as code, basic primitives that express anything else at least acceptably, and on 50's-60's hardware. Additionally, building a useful LISP (esp Scheme) is an academic exercise done all over the world that's fairly easy even for amateurs. Building a useful, non-optimizing C++ compiler with only a subset of LISP capabilities is an exercise only undertaken by masochists very dedicated to compiler design. Even a prototype is easier for LISP (a few pages of code) while a prototype of C++ or even C's semantics is much more challenging. So, the empirical evidence counters your claim in terms of completed projects, their complexity, and features received in return.
- kornish 11y ago> I find it plausible that making a lisp is easier, especially if it's interpreted, but it's not that easy. As an example, here's a guide for writing a Scheme interpreter in a matter of hours: https://en.wikibooks.org/wiki/Write_Yourself_a_Scheme_in_48_Hours https://en.wikibooks.org/wiki/Write_Yourself_a_Scheme_in_48_... It definitely doesn't take it months to walk away with a working implementation. Whether or not the language you've just written is actually useful or preferable to alternatives is a different question, and there I agree with you that communities, libraries, and language maturity can take a long time to build. Lisp's simple syntax makes it a prime target for creating new dialects (like Clojure) to experiment with semantics.
- Sanddancer 11y agoI disagree there pretty heavily. There are a lot of C implementations out there -- gcc, clang, msc, icc, keil, cscript, tcc, pcc, etcetc. The big reason C hasn't turned into a similar Tower of Babel is that the various stakeholders in C recognize that it's a living language, and get together regularly to help work out methods that aren't useful anymore and add features to the specification to reflect what modern programmers want. If C had stopped standardization when ANSI C was released, you'd see a similar number of variants.
- nickpsecurity 11y agoThe prior point still stands if you compare the number of LISP modifications... basically every program with macros + interpreters + compilers... to the few things you've cited which were often a lot of work and hard to change. GCC particularly. I agree the C crowd is more unified and that has huge impact. I'd go further to suggest that the legacy effect of UNIX and all the C libraries keep thing compatible. The C crowd is always sort of in maintenance mode for their language to keep everything working. While the LISP crowd rarely keeps anything and is often developing forms of the language. A subset are more practical with something long-term for real world use but most aren't. This difference between C use cases and LISP is worth exploring in answering these questions.
- lisper 11y ago> I agree the C crowd is more unified and that has huge impact. That's true, but it's important to understand which way the causality runs: the C crowd is unified because it's simply not possible to productive any other way. So C weeds out non-team-players in a way that Lisp doesn't.
- nickpsecurity 11y agoThat's a good point. Many suggested LISP needed that and would get more traction. Two example in that direction, Racket and Clojure, are kicking butt with one even mainstreaming. So, maybe major Schemes and CL's need to do that just a tad more.
- informatimago 11y agoI disagree there pretty heavily. There are a lot of C variants over there: Objective-C, C++, Pro*C, etc. (There are a lot of software projects that actually include a specific C pre-processor of some kind, check, eg. the C sources of emacs lisp, of GNU clisp, etc). As soon as you write a new front-end to C, you get a C variant, just like as soon as you write a DSL in Lisp you get a Lisp variant (and vice-versa). The C world is a Tower of Babel. Now, it's true that it's easier to do in lisp than in C, since in C the tools are external (you have to use flex/bison to implement the pre-processor) while in Lisp the tools are internal, and you just need to write a single defmacro to introduce your variant.
- kazinator 11y agoProducing a crappy interpreter for a toy C-like language is about the same as producing a crappy interpreter for a toy Lisp language. C did turned into a Tower of Babel: in the libraries. For instance Win32 is essentially one language, POSIX another. Portability among Unix systems alone used to be a mess of #ifdef directives through the 1980's and 1990's.
- lisper 11y ago>Producing a crappy interpreter for a toy C-like language is about the same as producing a crappy interpreter for a toy Lisp language. Ab-initio perhaps (and even that isn't clear because parsing sexprs is a lot easier than parsing C). But producing a production-compiler for a non-toy Lisp-like language given a compiler for Lisp is a heck of a lot easier than producing a production-quality compiler for a non-toy C-like language given a compiler for C. > C did turned into a Tower of Babel: in the libraries. Sure, and for the same reason: it's easy to write library code in C. In fact, that's the only thing that's easy to do in C. So that's what C programmers do: they write library code. They don't, as a general rule, write compilers. So the compilers stay stable and the libraries don't.