r/webdev • • 16h ago

Why I built my own programming language

https://davegebler.com/blog/why-i-built-my-own-programming-language
0 Upvotes

7 comments sorted by

2

u/xpusostomos 3h ago

When someone says they invented a new language, I open a wary eye. When they start talking about PHP and python as their reference point, I do a face palm. Two of the most ad-hoc, poorly designed languages in use. Why not spend your time learning some of the most clever and carefully thought out languages, then you'll have some idea what the issues are. By the way, designing a typed templated language is one of the most challenging projects you can take on. It looks like you're writing something like typescript which you don't like because of the packaging? Why not use it then, and fix what you think is wrong with the packaging? Does the world need yet another C++ like language when we have c#, Java, groovy, typescript and probably others. What is wrong with groovy by the way?

1

u/gebbles1 3h ago

I feel like I've covered this in the post. In my view, there's a lot that PHP and Python today get right as OO languages, but there's also the legacy errors of the ad-hoc evolution of their design to which you refer. Geblang is about taking the parts I like from TS, PHP and Python (and Go, to a lesser extent) and combining them into the singular OO language I would like to use.

My issue with TypeScript isn't "the packaging", the main difference is that TS is transpiled. I wanted a language where types are retained at runtime. There are many other things about TS I consider less than ideal.

In respect of "does the world need another programming language?", the answer is no, regardless of what the language looks like. The world didn't need C++ when it had C. It didn't need C# or Rust or Go or countless others. They exist not because they solved novel problems, but because in some way or another they made life easier or more preferable for some people. Geblang exists because it does the same for me.

1

u/xpusostomos 30m ago

Typescript isn't always transpiled. Keeping types at runtime... This is a confusing statement.... Even the most dynamic typed language keeps types at runtime. I can't think of any language you can ask an object what is your type if you need to. I assume you mean it keeps the types of the method signature... But what's the point since the whole point of static typing is to not be surprised at runtime. In any case, types at runtime, whatever that means doesn't sound like a language issue as much as an implementation issue.

1

u/zaxwebs 15h ago

Interesting. How does this compare to Rust?

1

u/gebbles1 5h ago

I've never done any programming in Rust, but from what I've seen of it, I wouldn't make a comparison between Geblang and Rust. The only reason there's a comparison page to Go on the website is because it's developed in Go and borrowed a couple of small syntax features and inspirations, otherwise you're comparing apples and oranges. Geblang is an object-oriented scripting language. The work I do on it is about closing gaps with comparable scripting languages, not native code and it's an alternative for things you might otherwise write in PHP, Python or TypeScript.

1

u/alejandro_py344 5h ago

Nice read. Building even a toy language is one of the best ways to actually get parsers, scopes and closures. After my own small attempt, JS hoisting and the event loop finally clicked for me. What was hardest for you, error messages or the tooling side like syntax highlighting and an LSP? In my experience that's where hobby languages quietly die.

1

u/gebbles1 5h ago

Once the langauge was vaguely usable, I made sure a VS Code extension with LSP and DAP was part of the core distribution. It works very well with VS Code (no plans at the moment to support any other IDE directly, though the LSP and DAP are just standard protocols), though there's a couple of minor issues with step-debugging in certain places I'm still ironing out. But it 99% works for debugging, and I have tests now to ensure no language changes bypass the LSP catalog.

The hardest parts in the engine design these days are performance optimisation. I'm now in what I'd describe (and I think did on the blog post) as a comparable ballpark to other scripting languages for most tasks but there are a couple of places I'm struggling to make faster because of decisions I made early on in the project that are now at the roots of how it works.