← Back to context

Comment by lopatin

15 days ago

Does decades of empirical evidence not prove that people are more comfortable with imperative, curly brace programming over s-expressions? It's not a chicken and egg problem. The egg has hatched and nested parentheses lost.

You may be right, idk, but I want to point out that you’re conflating two orthogonal concepts: S-expressions and imperative vs. functional programming.

There are lisp dialects that are very imperative, for example elisp, but they still use S-expressions. Historically they might have been considered “functional” because they have first-class functions and higher-order functions like mapcar, but nowadays practically every modern programming language (except go!) has these.

The thing all lisp dialects have in common is not where they land on the imperative vs. functional spectrum, but rather the fact that the syntax is trivial and so it’s easy to write powerful macros.

  • I think the simple uniform syntax is the main reason why Lisp never became popular.

    Code is communication, and communication needs redundancy for error correction. You can see it in natural languages, and it makes sense to have it in programming languages as well. Using different kinds of syntax for expressing different ideas is an easy way to increase redundancy without making the code more verbose.

    • Clojure has all those other braces also. They’re just used for data structure literals rather than blocks of code.

    • Or as I tell my colleagues who try to push for more abstract syntax: do you want your brain to do compilation each time your read something, or just have verbose text giving hints at each line ?

      It s weird people prefer reading implicit text.

      1 reply →

Decades of empirical evidence prove that people are more comfortable with functional, reactive, beging/end delimited programming, i.e. Excel.

  • millenia of empirical evidence and through to today, shows that most people are more comfortable not coding at all.

No, it doesn’t.

What has happened in reality is that C became really popular and then all the people designing languages they wanted to be popular, rather than to be experimental, or to push boundaries, etc obviously chose a syntax which was familiar with most programmers, ie a syntax like C’s.

Further, one can disprove that the syntax is particularly important by simply pointing to Python which became immensely popular despite a lack of curly braces and even worse with significant white space simply because colleges and bootcamps decided it would be a good language to teach programming to beginners.

  • Arguably python and c are much more similar than any of them compared to a lisp.

    I would argue the important part are the blocks in the former two, which sort of gets lost in the homogeny of lisps. Whether a block is marked with curly braces or indents doesn’t matter much - they being dissimilar to a regular expression does. Of course well-formatted lisp code tries to indent as well, but still there is a lot of visual noise there making it harder to visually inspect the code, I would guess.

    Of course familiarity with a given way is significantly more important. We pretty much learnt the non-intuitive writing of math, to Chinese people their writing system is the intuitive one, etc.

Hmm, can't find the paper (mostly clutter from language bootcamp results) but around a decade or so back there was an education research project that concluded that teaching SQL first, rather than any imperative language (regardless of punctuation), was better for getting students to develop reasonable mental models for computing. (Unfortunately without the reference I can't address what the criteria for "better" were - but "what people get paid to do" isn't really proof of comfort at any level...)

I think it's quite telling that almost all of the innovations in lisp (garbage collection, first class functions, repl etc) have been absorbed into more popular languages except for s-expression syntax, which remains a small niche despite many great implementations of s-expression based languages.

  • Because as soon as you adopt the s-expressions, what you got is no longer <language>, but lisp itself. Something like this:

      static char _getch() {
        char buf;
    
        if (read(0, &buf, 1)) return buf;
    
        return '\0';
      }
    

    would become:

      (define _getchar ()
        (declare static)
        (return-type 'char)
        (let ((buf (char)))
          (if (read 0 (& buf) 1)
            buf
            "\0")))

    • No. There is a good github gist rant I can’t find anymore, but if we call every AST in the form of s-expressions lisp, then is anything lisp? A programming language has to have an associated evaluation strategy, otherwise it’s just data. What you wrote only makes sense to execute as C code, which sure you can write a compiler for in your given lisp as well (so can you write a C compiler taking C AST in any other language, so it’s not special at all).

      2 replies →

    • Right. From which we can infer people like many things about lisp except for the syntax.

Does over a century of empirical evidence not prove that people are more comfortable with keyboards whose top row is laid out "QWERTYUIOP"?

Has there ever been research on this? Perhaps this situation has come about because the schools people must go to to get the programming jobs only teach the Javascript way? It seems circular logic to say that the current paradigm must be superior for the fact that it is the current paradigm. Is it possible that there are other reasons it reached that status?

  • does n=1 count? :)

    some time ago I tried Racket, and just no. recently I tried Scala ZIO HTTP, and yes.

    Maybe it's the types? Maybe it's the parens. But probably both. I cannot really recall my experience, just that manipulating code was ridiculously clunky. My assumption was that the IDE will manage the parens for me and when I'm moving something somewhere it'll figure out if I messed up the parens.. and ... no, nothing. I had to balance them with hand.

    • One reason emacs is popular for lisp programming is that the paredit package (or its newer competitor smartparens) do basically exactly what you describe: structural editing of sexp-based languages.

      1 reply →

No, because people who start in programming do not go to a syntax comfort clinic, where they are tested, and then assigned to a programming language.

It only proves that those languages are the most learned because they are the most popular in industry.

It says nothing about what makes a language easy to learn.