Re:Why most of us won't be inventing little languages
by antipurist on Monday April 17, 2023 @08:05AM
(#35599521)
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.
[ Parent
| on HN ]
Re:Why most of us won't be inventing little languages
by Warwolt on Monday April 17, 2023 @08:12AM
(#35599585)
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?
Re:Why most of us won't be inventing little languages
by chrismsimpson on Monday April 17, 2023 @08:11AM
(#35599577)
Firstly, JS is a horrendous target. Second, breakpointing in another language is about as great (possibly worse) as debugging via printf.
Re:Why most of us won't be inventing little languages
by pmoriarty on Monday April 17, 2023 @08:14AM
(#35599598)
printf debugging is infinitely better
Re:Why most of us won't be inventing little languages
by chrismsimpson on Monday April 17, 2023 @08:15AM
(#35599614)
Agreed
Re:Why most of us won't be inventing little languages
by auggierose on Monday April 17, 2023 @08:48AM
(#35599875)
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!
Re:Why most of us won't be inventing little languages
by JonChesterfield on Monday April 17, 2023 @08:54AM
(#35599925)
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.
Re:Why most of us won't be inventing little languages
by viraptor on Monday April 17, 2023 @08:55AM
(#35599939)
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.
Re:Why most of us won't be inventing little languages
by hu3 on Monday April 17, 2023 @08:56AM
(#35599940)
> 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.
Re:Why most of us won't be inventing little languages
by matijash on Monday April 17, 2023 @10:24AM
(#35601189)
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.