[Python-ideas] Modern language design survey for "assign and compare" statements

Franklin? Lee leewangzhong+python at gmail.com
Mon May 21 21:09:37 EDT 2018


On Mon, May 21, 2018 at 7:40 PM, Steven D'Aprano <steve at pearwood.info> wrote:
> On Mon, May 21, 2018 at 09:43:45AM -0700, Mike Miller wrote:
>> To clarify there were three main criteria, and one minor.  Newer,
>> popular/becoming industry standard, and designed to address shortcomings in
>> previous generations.  Finally, the limit of my energy when already working
>> on a project.
>
> To take your criteria in reverse order:

What acknowledgement do you want him to make? That your list is
better? I'm not sure what's the point of continuing this line of
questioning.

Personally, I don't think we should restrict the survey to newer
languages. New changes to older languages are also relevant.

C++17 is adding initialization syntax to `if`.
    http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0305r0.html
Why they're doing that, when C++ has assignment expressions, may or
may not be relevant to this discussion.

> 1. Why should the limit on *your* energy be a deciding factor? I was
> willing to spend a few hours doing a more complete sample of new
> languages. Should we ignore those because you ran out of energy? If
> anyone else wants to extend it even further, and survey more languages,
> we should welcome an even more extensive survey.

It should not. But it is. He's simply admitting it.

> 2. By definition, EVERY new language is designed to "address
> shortcomings in previous generations" of languages. If the designer
> thought previous languages were ideal, they wouldn't invent a new
> language.

Perhaps Mark wants to say that these languages were meant to replace
particular languages. Each of his examples listed languages that they
were meant to replace, and those replaced languages aren't exactly
esoteric, academic, or whatever Perl is. They're languages by industry
giants.

> 3. None of the languages you surveyed are "popular/becoming industry
> standard" according to the closest thing we have to an objective
> measure of popularity: rankings like those provided by TIOBE. If you
> don't like TIOBE's methodology, feel free to propose a different,
> neutral, ranking.
>
> If you want a subjective opinion based on "industry buzz", then I would
> say that out of the five languages you listed, only two (Go and Swift)
> are anything close to "becoming industry standard", a tiny sample
> indeed, but nevertheless one where both languages have some form of
> assignment expressions (Go only in "if" statements, Swift everywhere).

"Industry _standard_" may be the wrong term. Except for maybe Kotlin,
the languages are created and backed by major players in the industry:
Apple, Mozilla, and Google.

> 4. What was your criteria for "newer"? I must admit I assumed it
> was languages invented since 2010, but I see Go was invented in
> 2009.

Current top 50 programming languages, filtered by year >= 2000. (Years
are from quick Google and Wikipedia lookups.)
6   Visual Basic .NET  2001
14  Go                 2009
19  Swift              2014
20  Scala              2004
21  Apex               2006
26  Dart               2011
31  D                  2001
33  Scratch            2002 (2007)
37  Clojure            2007
41  OpenCL             2009
46  Julia              2012
49  Kotlin             2011

Possible removals:
- Some might argue that Visual Basic .NET is just a rebranding of
Visual Basic, an older language.
- Scratch looks like it's a language for teaching, not using, and I'm
not sure why it's on the list.
- I don't know whether to remove Apex, since it's specific to one
platform and it sounds like it's almost Java.
- Similarly, OpenCL sounds like it's just a fork of C/C++ for GPUs.

With those languages removed, and reverse-sorted by year:
19  Swift              2014
46  Julia              2012
26  Dart               2011
49  Kotlin             2011
14  Go                 2009
37  Clojure            2007
20  Scala              2004
31  D                  2001

Mark's list captures four of the first five, while Rust is nowhere to
be seen. Without Julia, "publicized in the last ten years" describes
the split pretty well.

Clojure and Scala may be outside of Mark's experience. They are
functional languages, with at least a lean toward pure functions.
Clojure, being a Lisp, probably uses `let` for name-binding, and I
assume you'd make a macro for assign-and-compare if you want it, so it
might not be informative for Python's decision. In Scala, pretty much
everything is an expression (as it is in Lisp), so it might also be
uninformative .

D is much older than the others, but given its design goals, it might
be interesting to look at anyway.

That leaves Julia.

> If your cutoff is 2009, then we ought to include Coffeescript,
> which also has assignment expressions.

CoffeeScript, like Scala, favors making things expression, so its
decision might not be informative.

CoffeeScript's grammar notes say, "[E]verything that can be an
expression is one."
http://coffeescript.org/v2/annotated-source/grammar.html


More information about the Python-ideas mailing list