DEV Community

Cover image for When Walter Bright Told Me to Write About My 2.4MB Language
Pouya Mohammadi
Pouya Mohammadi

Posted on

When Walter Bright Told Me to Write About My 2.4MB Language

When Walter Bright Told Me to Write About My 2.4MB Language

The Conversation That Started It All

A few days ago, I showed Walter Bright (creator of the D programming language) a project I'd been working on. His response was simple: "You should write an article about it."

When the person who built one of the most elegant systems programming languages tells you to write something, you listen. So Walter, this one's for you.

And to the D community who featured G in awesome-d - thank you. It's an honor to be listed among projects I've admired for years.

But here's the thing: G isn't "yet another D project." It's something different.


G Language: What Happens When You Say "No" to Bloat

# The entire language
$ du -h g
2.4M    g

# A complete program
$ cat hello.g
std.main:
    std.echo "No dependencies, no imports, no ceremony"
    ln
std.end: exit N

# Running it
$ glang -c hello.g
No dependencies, no imports, no ceremony

real    0m0.003s
Enter fullscreen mode Exit fullscreen mode

2.4 megabytes. That's not the standard library. That's not the "core runtime." That's everything: interpreter, standard library, package manager - all in one binary that starts in 3 milliseconds.

Why Does This Matter?

Because somewhere along the way, we forgot that software should be simple. That tools should disappear and let you work. That a programming language doesn't need to solve every problem - just the ones you actually have.

G is my protest against:

  • npm install that downloads half the internet
  • Python virtual environments that need their own management system
  • Rust compile times measured in coffee breaks
  • "Lightweight" tools that still need 200MB of dependencies

The G Philosophy: Do One Thing Well

1. Memory Safety Without the Headache

This won't segfault. Ever.
std.main:
    glue file
    file.read "Hi.txt"
    fecho %
    ln
std.end: exit N
Enter fullscreen mode Exit fullscreen mode

G doesn't have Rust's borrow checker or Go's garbage collector. It has boundaries you can't accidentally cross. Simple. Effective.

2. The [@] Accumulator - Love It or Leave It

std.main:
    [@] : 10
    [@] : * 2
    [@] : - 5
    std.echo "Result: "
    int.echo
    ln
std.end: exit N
Enter fullscreen mode Exit fullscreen mode

This is G's most controversial feature. One implicit register for calculations. No variable names for throwaway math. It's divisive. It's different. It works.

3. Packages That Respect You (flex)

std.main:
    glue flex.netg
    [%] : "https://glang.ct.ws/"
    fn netg

std.end: exit N
Enter fullscreen mode Exit fullscreen mode

Most package managers: "Here's 200MB of dependencies you'll use 3% of."
flex: "Here's the 50KB you actually need. It won't break tomorrow."

Real Work, Real Code

How to Get G (It's Easier Than Installing Python)

# On literally any system
# just download binery from github.com/pouyathe/glang
./glang -v

# Prove it works
./glang -c hello.g

# Keep it anywhere
sudo mv glang /usr/bin/
Enter fullscreen mode Exit fullscreen mode

No package manager. No dependencies. No "post-install setup." Just a binary that runs.

Who Actually Uses This?

The Overworked Sysadmin

"Bash scripts break at 3 AM. Python needs the right version. G just works."

The Embedded Developer

"My device has 8MB flash. Python won't fit. G takes 0.3% of my storage."

The Educator

"I can't ask students to download 2GB of tooling. G fits on a USB drive from 1998."

The Curious Programmer

"I read the entire G source code in an afternoon. It's a language that doesn't hide its secrets."

Technical Truths (For The Detail-Oriented)

  • Written in: D (but you never need to know this)
  • Performance: Faster than Python, slower than C
  • Memory: Safe for everything except maybe rocket guidance
  • License: GNUv3 (free as in "do whatever, just share improvements")
  • Status: v5.7.6 - works today, improving tomorrow

The Roadmap (Short and Realistic)

  1. More flex packages (by the community, for the community)
  2. Better error messages (currently they're... terse)
  3. WASI support (run in browsers, because why not?)
  4. That's literally it

G won't get type inference. Or macros. Or a complex module system. That's the point.

Join Us (Or Don't - That's Fine Too)

G isn't trying to be the next big thing. It's trying to be useful. To stay small. To disappear when you're using it.

If you:

  • Have ever cursed at pip or npm
  • Want to understand how interpreters work
  • Need a reliable scripting language for systems work
  • Believe software has gotten too damn big

Then you might like G.

Try it (30 seconds): glang.ct.ws
Star it (1 click): github.com/pouyathe/glang
Ignore it (also fine): Your existing tools work too


Questions Walter Might Ask (And You Too)

  1. Why not just use D? Because sometimes you need a hammer, not a toolbox.
  2. Is this "production ready"? It's ready for the productions I use it in.
  3. What about concurrency? Not yet. Maybe never. Most scripts don't need it.
  4. Why the weird syntax? Because mainstream syntax comes with mainstream complexity.

Walter, thanks for the nudge. D community, thanks for the recognition. Everyone else, thanks for reading. Now go write some code that doesn't need 200MB of dependencies.

G Language: For when you have actual work to do.

Top comments (1)

Collapse
 
pouyathe profile image
Pouya Mohammadi

Quick update: Added Ubuntu installer script based on feedback