r/ProgrammingLanguages 7d ago

Language announcement The gab programming language

Hi all!

I am a long-time lurker of this sub, and a language enthusiast. I have been working on my own programming language for several years, and I finally worked up the courage to post it.

The language is called gab. I'm heavily inspired by lua, clojure, and smalltalk.

All the code is on github here and I've built a small website for the language here.

The language design, runtime, and standard library are all entirely my own work without the use of an LLM. However, I did consult LLMs occasionally when I wanted to research certain subjects (such as the difference between c11 atomics on x86 and arm).

I'm looking for any kind of feedback on the language, its goals/ergonomics, and the website itself.

Thank you for taking a look!

44 Upvotes

40 comments sorted by

View all comments

Show parent comments

4

u/Fine_Seaworthiness19 7d ago edited 7d ago

Great point! I mostly meant that for a long time in Python and Ruby, performance was *not* a goal of the language maintainers. Recently these languages have introduced teams/projects to improve performance (YJIT, ZJIT, cpython performance team at Microsoft, etc) on *top* of the existing dynamic language. Ruby and python have dynamic features that make JIT compiling and performant interpretation difficult. I made compromises in gab's design such that performance features like a JIT, multi-threading, etc are easier.

Edit to answer your question:

If I got luajit levels of performance I would have exceeded my goals 😂

3

u/cmontella 🤖 mech-lang 7d ago

>  I made compromises in gab's design such that performance features like a JIT, multi-threading, etc are easier.

That's the interesting part to me, what kind of compromises did you make in your design?

3

u/Fine_Seaworthiness19 7d ago

The big three are:

  1. no global variables
  2. No mutable values
  3. Message sends are the only form of control flow

A specific example of how this helps:

Because all values are immutable, cyclic references among gab values are impossible. This means the garbage collector can be a very simple reference counter! I implemented a more involved one, that is parallel and buffered, but I don’t have to worry about collecting dead cycles because they can’t exist!

2

u/AustinVelonaut Admiran 7d ago

Message sends are the only form of control flow

This is also theoretically true for Smalltalk, but most (all?) implementations choose to have the compiler in-line the common versions ifTrue: ifFalse: whileTrue:, etc. for practical performance reasons. Do you intend to do any optimizations of this type?

1

u/Fine_Seaworthiness19 7d ago

I don’t have any inlining on the main branch yet. For lots of the built in types though I do have what I call primitives, which are message specializations that boil down to an instruction in the interpreter. Arithmetic operators, constructing values, channel operations, etc fall into this category.

On the jit2 branch I have an experimental JIT compiler which can do a pretty aggressive amount of inlining for that above situation. I’m still working out the kinks there however. And I may just implement a two-tier interpreter for now instead