4 ms·
> it feels like it departs from what people know without good reasons. Lua is a pretty old language. In 1993 the world had not really settled on C style syntax
by spacechild1 10mo ago
> it feels like it departs from what people know without good reasons.
Lua is a pretty old language. In 1993 the world had not really settled on C style syntax. Compared to Perl or Tcl, Lua's syntax seems rather conventional.
Some design decisions might be a bit unusual, but overall the language feels very consistent and predictable. JS is a mess in comparison.
> because it departs from a more Algol-like syntax
Huh? Lua's syntax is actually very Algol-like since it uses keywords to delimit blocks (e.g. if ... then ... end)
- lioeters 10mo ago> consistent and predictable That's what matters to me, not how similar Lua is to other languages, but that the language is well-designed in its own system of rules and conventions. It makes sense, every part of it contributes to a harmonious whole. JavaScript on the other hand. When speaking of Algol or C-style syntax, it makes me imagine a "Common C" syntax, like taking the best, or the least common denominator, of all C-like languages. A minimal subset that fits in your head, instead of what modern C is turning out to be, not to mention C++ or Rust.
- procaryote 10mo agoIs modern C really much more complicated than old C? C++ is a mess of course.
- lioeters 10mo agoI don't write modern C for daily use, so I can't really say. But I've been re-learning and writing C99 more these days, not professionally but personal use - and I appreciate the smallness of the language. Might even say C peaked at C99. I mean, I'd be crazy to say that C-like languages after C99, like Java, PHP, etc., are all misguided for how unnecessarily big and complex they are. It might be that I'm becoming more like a caveman programmer as I get older, I prefer dumb primitive tools.
- procaryote 10mo agoC11 adds a couple of nice things like static asserts which I use sometimes to document assumptions I make. They did add some optional sections like bounds checking that seem to have flopped, partly for being optional, partly for being half-baked. Having optional sections in general seems like a bad idea.
- anthk 10mo agoIDK about C11; but C99 doesn't change a lot compared to ANSI C. You can read The C Programming Language 2nd edition and pick up C99 in a week. It adds boleans, some float/complex math ops, an optional floating point definition and a few more goodies: https://en.wikipedia.org/wiki/C99 https://en.wikipedia.org/wiki/C99 C++ by comparison it's a behemoth. If C++ died and, for instance, the FLTK guys rebased their libraries into C (and Boost for instance) it would be a big loss at first but Chromium and the like rewritten in C would slim down a bit, the complexity would plummet down and similar projects would use far less CPU and RAM. It's not just about the binary size; C++ today makes even the Common Lisp standard (even with UIOP and some de facto standard libraries from QuickLisp) pretty much human-manageable, and CL always has been a one-thousand pages thick standard with tons of bloat compared to Scheme or it's sibling Emacs Lisp. Go figure.
- procaryote 10mo agoC++ is a katamari ball of programming trends and half baked ideas. I get why google built golang, as they were already pretty strict about what parts of the c++ sediments you were allowed to use.
- anthk 10mo agoNot Google actually, but the same people from C, AWK and Unix (and 9front, which is "Unix 2.0" and it has a simpler C (no POSIX bloat there) and the compilers are basically the philosophy of Golang (cross compile from any to any arch, CSP concurrency...) Also, the Limbo language it's basically pre-Go.
- bmacho 10mo agohttps://en.wikipedia.org/wiki/Go_(programming_language)#History https://en.wikipedia.org/wiki/Go_(programming_language)#Hist... : "Go was designed at Google in 2007"
- anthk 10mo agoNo. https://en.wikipedia.org/wiki/Alef_(programming_language) https://en.wikipedia.org/wiki/Alef_(programming_language) https://en.wikipedia.org/wiki/Limbo_(programming_language) https://en.wikipedia.org/wiki/Limbo_(programming_language) https://en.wikipedia.org/wiki/Newsqueak https://en.wikipedia.org/wiki/Newsqueak https://en.wikipedia.org/wiki/Communicating_sequential_processes https://en.wikipedia.org/wiki/Communicating_sequential_proce... https://doc.cat-v.org/bell_labs/new_c_compilers/new_c_compiler.pdf https://doc.cat-v.org/bell_labs/new_c_compilers/new_c_compil... It was amalgamated at Google. Originally Go used the Ken C compilers for Plan9. It still uses CSP. The syntax it's from Limbo/Inferno, and probably the GC came from Limbo too. If any, Golang was created for Google by reusing a big chunk of plan9 and Inferno's design, in some cases even straightly, as it shows with the concurrency model. Or the cross-compiling suite. A bit like MacOS X under Apple. We all know it wasn't born in a vacuum. It borrowed Mach, the NeXTStep API and the FreeBSD userland and they put the Carbon API on top for compatibility. Before that, the classic MacOS had nothing to do with Unix, C, Objective C, NeXT or the Mach kernel. Mac OS X is to NeXT what Go is for Alef/Inferno/Plan9 C. As every MacOS user it's using something like NeXTStep with the Macintosh UI design for the 21th century, Go users are like using a similar, futuristic version of the Limbo/Alef programming languages with a bit of the Plan9 concurrency and automatic crosscompilation.
- lucketone 10mo agoI known for very long time that c (and co) inherited the syntax from algol. But only after long time I tried to check what Algol actually looked like. To my surprise, Algol does not look anything like C to me. I would be quite interested in the expanded version of “C has inherited syntax from Algol” Edit: apparently the inheritance from Algol is a formula: lexical scoping + value returning functions (expression based) - parenthesitis. Only last item is about visual part of the syntax. Algol alternatives were: cobol, fortan, lisp, apl.
- spacechild1 10mo agoThe use of curly braces for delimiting blocks of code actually comes from BCPL. Of course, C also inherited syntax from Algol, but so did most languages.