Programming languages with small surface area
10 points by orangetuba 2 years ago | 17 commentsI tried hard to like Go, but as of now, I just don't like it. What languages would you recommend that I check out? I already know Python and C, and I would like to learn something more performant than Python.
- karmakaze 2 years agoF#/OCaml may not have a small total surface area (I'm not that deep in it), but you can do a whole lot knowing basic constructions.
If you haven't used a functional language there's an alternative approach without the cognitive overhead of thinking about statements executing in time (most of the time). For a non-static typed example, Elixir (but that usually also brings in Phoenix framework). Zig is another interesting one for different reasons.
- hazelnut-tree 2 years agoThere are not many languages (in active use) with a small surface area. Go is small, Lua is another. However, a small language does not always mean simple - you may still encounter code that is difficult to unravel.
New programming languages tend to range from medium-to-large in size.
Here are number of keywords in some languages. Note: this is a bit of a blunt measure of a language's size so you may not consider it a measure of small surface area:
- Lua (21 keywords)
- Go (25 keywords)
- Julia (30+ keywords)
- Python (30+ keywords)
- Javascript (30+ keywords)
- Ruby (40+ keywords)
- Crystal (50+ keywords)
- Rust (50+ keywords)
- Nim (60+ keywords)
- C# (70+ keywords)
- PHP (70+ keywords)
Languages still in development
- Odin (30+ keywords)
- V lang (40+ keywords)
- Zig (40+ keywords)
- karmakaze 2 years agoSyntax isn't what makes a language easy or hard. In fact more syntactic forms (up to a point) makes a language easier. e.g. ownership and borrow-checking isn't hard to learn in Rust because of the syntax.
A better estimation would be by language concepts, with some being more weighty than others.
- orangetuba 2 years agoThank you so much for taking the time to compile this list! I had no idea C# has so many keywords.
- karmakaze 2 years ago
- Qem 2 years agoIn terms of surface area, I think is hard to beat languages in the Smalltalk family. Smalltalk has only six reserved words: true , false , nil , self , super and thisContext. To emphasize the simplicity, there is even a smalltalk postcard to show the whole syntax fits on it. See https://richardeng.medium.com/syntax-on-a-post-card-cb6d85fa...
I think this postcard remark may be a bit misleading sometimes, as in practice the complexity is shifted from syntax to the large class library in the system image, that packs a lot of functionality. But yet the environment is sweet and has great discoverability, with functionality like search by example. See https://youtu.be/HOuZyOKa91o
The Smalltalk flavor I strongly recommend is Pharo. There's a MOOC[1] on it, and there are several free books that cover the basics of the language itself[2][3], data visualisation[4] and numeric stuff[5]. [1]. https://mooc.pharo.org/ [2]. https://github.com/SquareBracketAssociates/PharoByExample9/r... [3]. https://books.pharo.org/deep-into-pharo/ [4]. http://agilevisualization.com/ [5]. https://books.pharo.org/numerical-methods/
- orangetuba 2 years agoWow, I had forgotten that this language even existed. Someone said that OO never clicked until they learned Smalltalk. Perhaps I should give a try, and perhaps it can improve my Python :-)
- orangetuba 2 years ago
- tionate 2 years agoClojure is tiny in that there are very few special forms (less than 20 according to [0]) and most things are just plain functions.
More importantly, it is developed extremely conservatively which means
1) you don’t need to learn the syntax/feature of the month (like eg javascript/python)
2) the code you wrote a decade ago will still work.
That said, it does sit on top of Java/JS so you can access those parts easily if you need to.
- orangetuba 2 years agoThis sounds excellent! I will have a look at it.
- orangetuba 2 years ago
- Jtsummers 2 years agoForth, Lua (with LuaJIT pretty quick), Scheme, Pascal, probably a lot more.
- eigenlicht 2 years agoPascal was probably intended to mean "classic"/procedural Pascal and that's been out of use for ages even in academia (just like Scheme). One might as well call out Algol. Anything even remotely useful these days wouldn't clock in that far behind Java or C++ from 20 years ago as for "surface", or indeed behind the closely related Ada no one would dream to suggest either. I realize you were not referring to the keyword measure, and Python already demonstrates how useful that is, but for a rough guide:
https://wiki.freepascal.org/Reserved_words
That's clearly more than 30 something. It's a huge system in other respects, baroque, I guess somewhat like Common Lisp once compared to Scheme. Whether still useful debatable. Lua indeed and JavaScript is what comes to my mind. Or if you already like Python and it's just about "speed" that's what Nim is supposed to be all about. Besides hardly getting more performant I'd keep my fingers off dead technology (like Forth!) unless you're really into the history thing, exotica or the sheer mind-boggling, which is also cool but sadly rarely productive.
- Jtsummers 2 years agoThey asked for a small surface area, Pascal and most of its descendants have a small surface area especially compared to their two "large languages" of C++ and Rust. If you look at built in operators and keywords Go certainly gets pretty big too:
25 keywords, 48 operators.break default func interface select case defer go map struct chan else goto package switch const fallthrough if range type continue for import return var + & += &= && == != ( ) - | -= |= || < <= [ ] * ^ *= ^= <- > >= { } / << /= <<= ++ = := , ; % >> %= >>= -- ! ... . : &^ &^= ~
Clearly more than 30 something. Since OP considers Go a small surface area language, I don't see how that list from Turbo Pascal would disqualify it.
> JavaScript is what comes to my mind.
If they suffer from analysis paralysis with Rust and C++, I don't see how JS would be much better with its millions of frameworks.
> Besides hardly getting more performant I'd keep my fingers off dead technology (like Forth!) unless you're really into the history thing, exotica or the sheer mind-boggling, which is also cool but sadly rarely productive.
They also never said they cared whether the technology was live or dead. What's it mean to be dead if it can still be run anyways?
- orangetuba 2 years agoThank you. I think you're absolutely right about JS. I would prefer to avoid dead technology, which is one of the reasons I haven't spent much time with schemes like Racket or GNU Guile.
- orangetuba 2 years ago
- orangetuba 2 years agoInteresting perspective. Thank you very much! I didn't quite get the part about Ada - is it a language with a large surface area?
- Jtsummers 2 years agoThe language itself is larger than go, mostly by virtue of its very rich type system. Otherwise it is a mostly conventional procedural language with built in concurrency and some OO features.
- Jtsummers 2 years ago
- Jtsummers 2 years ago
- eigenlicht 2 years ago
- tored 2 years agoThere are many BASIC dialects with a small surface area. The one I use is PureBasic, however it is commercial.
- aristofun 2 years agoRuby, Typescript
- huqedato 2 years agoElixir.