1. 5
  1.  

  2. 3

    I was honestly surprised to see “If expressions” mentioned, thought that was pretty standard since at least FORTRAN ;)

    1. 6

      Most of the features in here have existed for a very long time. I’m glad the author likes these features but there is nothing modern about most of them (presuming modern is within the last 10 years).

      1. 2

        I think I recognized many of them from Perl but don’t know enough about formal programming language terminology to identify them.

      2. 4

        Did FORTRAN have if expressions or if statements?

        1. 1

          Good point, I kinda missed it’s syntactic sugar around a (perhaps nested) ternary statement.

          1. 5

            Yeah this means an if/then construct that can be used in an expression context, e.g. you assign its result to a variable. Even that is a pretty ancient construct, since Lisp has had it forever. If we ignore Lisp and stick to Algol-like languages, there is a sense in which it seems newer-gen, since you find it in languages like Swift, but not in the generation of languages like C, Pascal, Java, etc., which made their if/then constructs statements. Although interestingly, the ancestor of all of these languages was Algol-60, which did have if-expressions. Presumably they were dropped from later Algol-influenced languages for reasons of compiler simplicity, and are now making a reappearance as people don’t care as much about that? Would be interesting to try to evaluate how many of Algol-60’s constructs that C dropped or simplified were actually good ideas and just at the wrong time for implementation.

            1. 9

              [About Algol 60] Here is a language so far ahead of its time, that it was not only an improvement on its predecessors, but also on nearly all its successors.

              - C.A.R. Hoare
              
              1. 2

                I hadn’t run across that quote; thanks! For anyone wondering, it appears to even be a fairly early opinion: it’s from the appendix of the 1974 paper “Hints on programming-language design”, where Hoare lists a number of papers he thinks are important to read, with short commentaries on each. The first one listed is the Algol-60 report, and this is his full commentary:

                The more I ponder the principles of language design, and the techniques that put them into practice, the more is my amazement at and admiration of ALGOL 60. Here is a language so far ahead of its time that it was not only an improvement on its predecessors but also on nearly all its successors.

                Of particular interest are its introduction of all the main program-structuring concepts and the simplicity and clarity of its description, rarely equalled and never surpassed. Consider especially the avoidance of abbreviation in the syntax names and equations and the inclusion of examples in every section.

              2. 1

                Whelp reading up about it turns out the ternary expression from C is actually syntactical… salt? acid around “real” if-expressions, that pre-dated them.

          2. 2

            The author also lists “try expressions” as a feature he says he would like to see in other languages.

            I would argue what they actually want isn’t “make more things into expressions” but “leave statements out of the language entirely since they are redundant”.

          3. 1

            I’m not familiar with Dart, knowing only of its existence, but I’m glad to see it has Smalltalk-style cacades.

            That’s something Python needs. Maybe I should write a PEP.