from Hacker News

Programming languages with small surface area

by orangetuba on 11/17/22, 4:48 PM with 17 comments

What are good programming languages with a small surface area? Languages like C and Go? With large languages like C++ and Rust, I get decision paralysis, and I end up spending too much time with language details.

I 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.

  • by karmakaze on 11/30/22, 11:00 AM

    F#/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.

  • by hazelnut-tree on 11/17/22, 7:42 PM

    There 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)

  • by Qem on 11/18/22, 1:18 PM

    In 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/

  • by tionate on 11/18/22, 7:49 AM

    Clojure 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.

    [0]: https://clojure.org/reference/special_forms

  • by Jtsummers on 11/17/22, 5:26 PM

    Forth, Lua (with LuaJIT pretty quick), Scheme, Pascal, probably a lot more.
  • by tored on 11/18/22, 11:57 AM

    There are many BASIC dialects with a small surface area. The one I use is PureBasic, however it is commercial.
  • by aristofun on 11/17/22, 6:07 PM

    Ruby, Typescript
  • by huqedato on 11/20/22, 1:06 AM

    Elixir.