]> Sergey Matveev's repositories - stargrave-blog.git/commit
Роб Пайк об истории появления Go: less is more
authorSergey Matveev <stargrave@stargrave.org>
Mon, 14 Nov 2022 06:49:50 +0000 (09:49 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Mon, 14 Nov 2022 06:49:50 +0000 (09:49 +0300)
commit2e27d5c264f5b59374b193e972190ff3af53bbc6
tree4b825dc642cb6eb9a060e54bf8d69288fbee4904
parent7cfea752609bf218e2c49e4cd022b84e7ee3ddd3
Роб Пайк об истории появления Go: less is more

https://commandcenter.blogspot.com/2012/06/less-is-exponentially-more.html
Какие упрощения были сделаны относительно C/C++ того времени?

    * regular syntax (don't need a symbol table to parse)
    * garbage collection (only)
    * no header files
    * explicit dependencies
    * no circular dependencies
    * constants are just numbers
    * int and int32 are distinct types
    * letter case sets visibility
    * methods for any type (no classes)
    * no subtype inheritance (no subclasses)
    * package-level initialization and well-defined order of initialization
    * files compiled together in a package
    * package-level globals presented in any order
    * no arithmetic conversions (constants help)
    * interfaces are implicit (no "implements" declaration)
    * embedding (no promotion to superclass)
    * methods are declared as functions (no special location)
    * methods are just functions
    * interfaces are just methods (no data)
    * methods match by name only (not by type)
    * no constructors or destructors
    * postincrement and postdecrement are statements, not expressions
    * no preincrement or predecrement
    * assignment is not an expression
    * evaluation order defined in assignment, function call (no "sequence point")
    * no pointer arithmetic
    * memory is always zeroed
    * legal to take address of local variable
    * no "this" in methods
    * segmented stacks
    * no const or other type annotations
    * no templates
    * no exceptions
    * builtin string, slice, map
    * array bounds checking

    We also added some things that were not in C or C++, like slices and
    maps, composite literals, expressions at the top level of the file
    (which is a huge thing that mostly goes unremarked), reflection,
    garbage collection, and so on. Concurrency, too, naturally.

Ну и заканчивает это всё очень правильными высказываниям

    Python and Ruby programmers come to Go because they don't have to
    surrender much expressiveness, but gain performance and get to play
    with concurrency.

    C++ programmers don't come to Go because they have fought hard to
    gain exquisite control of their programming domain, and don't want
    to surrender any of it. To them, software isn't just about getting
    the job done, it's about doing it a certain way.

    The issue, then, is that Go's success would contradict their world view.

    And we should have realized that from the beginning. People who are
    excited about C++11's new features are not going to care about a
    language that has so much less.  Even if, in the end, it offers so
    much more.