Hacker News new | ask | show | jobs
by antipurist 1162 days ago
There is a third option: make your language shine where it matters (to you), and accept subpar experience in areas that matter less. Specific things you mentioned — debugging, profiling & analysis — could be treated as a solved problem if you transpile your language into some other language that already has these nice-to-haves. JS is a wonderful target, as long as you generate something remotely readable you already have a way to debug it, no need to reinvent it. Instead, it's much more fun and beneficial to focus on the reason you want to create the language, on the features that make it stand out.
3 comments

This is how we went with https://wasp-lang.dev/ (a DSL for building full-stack web apps). It is a very declarative language (config pretty much) and there is still plenty of work around tooling, but also enabled to cut down on a lot of boilerplate.

Another route to consider when implementing a DSL, is to make an embedded one (e.g. like Terraform or Pulumi have, even both at the same time). That doesn't resolve all the tooling problems since there is still a compile step, but might provide a more integrated experience, although at the cost of brevity.

Firstly, JS is a horrendous target. Second, breakpointing in another language is about as great (possibly worse) as debugging via printf.
Unless you write a basic interpreter or code in plain binary, you're breakpointing in another language. It's really not a big deal as long as you preserve the mapping to the original code.

When you breakpoint in C, you breakpoint in assembly and find your C location from the debug information for example.

> Second, breakpointing in another language is about as great (possibly worse) as debugging via printf.

You don't have to. Just generate sourcemaps and you'll be able to set breakpoints in your own language even when targeting JS.

If anything that makes JS an even better target since you can leverage tooling.

Depends on your needs. In terms of functionality, JS has everything you might want, even the ability to execute itself. Viewed as a platform, not just a language, it offers WebAssembly, soon WebGPU. I don't see anything else that comes even close as a target platform!
The usual choice is C. I'm currently liking luajit as the tracing cuts through some of the DSL. The JavaScript compilers probably manage the same thing.
printf debugging is infinitely better
Agreed
I think this is an important point. Comparing an initial implementation of a language with that of mature projects doesn't make sense. Every cool language started off in a rough initial state I'd wager, and many were initially developed by a single person, so why not give it a shot if it's compelling?