Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This one from the article is a bit weird:

> Sophisticated DSLs with special syntax are probably a dead-end. Ruby and Scala both leaned hard into this and neither got it to catch on.

Rails is one of the most popular web frameworks around and a combo of Rails and Ruby power some really high traffic / high importance platforms like GitHub, Shopify and Stripe's API.



Ruby had a huge hype, then its growth slowed down and now it's falling behind quickly. Yeah it's big, but other frameworks that chose a different path w.r.t. metaprogramming seem to be the more popular (and growing) choice today.


While that may be true, I'm not sure that's evidence that DSL's are the reason. I would argue the explanation is: JavaScript. I think many people are compelled by the idea that you can learn one language, and handle both back and front-end development. As the language has improved over the past ~10 years, this angle has only become more compelling, and has eaten into the popularity of other "traditional" web frameworks like Django, Rails, Spring, etc.


I myself am one of these people. But even if Ruby worked anywhere and I could share all my code, I would still prefer TypeScript because of its support for typed JSX and excellent typing system overall. The IDE can help me in most cases, while it stays silent a lot with Ruby. I just don't see what more Ruby offers - and I'm saying that as someone who really likes OOP and really wanted to like Ruby.


I think JavaScript benefits from typing a lot more than Ruby does. Ruby is at least strongly typed, so doing something like `[] + {}` or `4 + {foo: "bar"}` will raise an exception instead of return you a seemingly-arbitrary value.

As far as what Ruby offers over JavaScript? It's a bit personal preference, but I prefer Ruby for several reasons:

- More stable ecosystem. There are more canonical "best" tools for the job. There's one dominant web framework, one dominant background job processor, one dominant task runner, debugger, testing framework, etc.

- More robust standard library. Enumerable rocks. And rolls.

- Better fits "OO" definitions—everything is an object in Ruby. It supports public/private/protected instance methods/variables.


I was about to say as well, JavaScript, SQL, were both niche DSLs that are now mainstream enough that people prep them for general software development interviews.

JavaScript is now a general language, but maybe the most popular DSLs break out of that once they've gained a certain mindshare, at which point they're no longer a DSL.


That's a category error. Ruby is not a framework.


Doesn't matter, almost nobody uses Ruby without Rails. And my statement holds true for any Ruby framework.


> my statement holds true for any Ruby framework

Are you sure all Ruby frameworks use the same "path w.r.t. metaprogramming" as Rails? It's been a while since I looked at them but I recall many priding themselves in the difference back then.


Ruby programmers still use the features, even if their framework doesn't


And you're saying that that was the reason? I'm just trying to divine the relevance of the "other frameworks that chose a different path w.r.t. metaprogramming seem to be the more popular (and growing) choice today" claim.


Sorry, meant languages+frameworks, not just frameworks there. I was thinking of TS+React or C#+ASP.NET in that particular case.


It's hard to complete with JavaScript on client and server. How's the Ruby to JS story these days?


Ehh, when I would introduce people to a rails project, I always got to a point where I said basically what the author says. Usually either while explaining rspec (and `let` especially) or the routes.rb file. Rspec and the routes file are still around, but you used to see that sort of thing a lot more.

My impression is that Ruby libraries have leaned away from DSLs over time. Rails hasnt added a new DSL in a long time, none that I can think of anyway.


I also don't understand the notion that the various bits of ruby that look like a "DSL" even qualify for this rule.

Ruby's syntax allows for writing things in a pretty expressive style, often not requiring parentheses (for parameters) or curly braces (for object/hash literals), and that allows you to write ruby code in a way that sorta looks like a nice DSL. But it's very much not a DSL, it doesn't have "special syntax", it's just... Ruby. Just because Ruby can be written beautifully doesn't mean Ruby "leaned hard into this".


I think he meant creating new DSLs for program code, not so much as a way to make libraries and frameworks more accessible. From my experience with Ruby, I really love well designed DSLs (like good APIs in general), but when people start to create their own mini-languages in existing codebases, you really have to call them back, because the quality of that code will be much harder to control (mostly because of the implementation via metaprogramming magic).


Languages that allow the creation of such DSLs do, in the end, seem to be gradually declining in popularity. This is probably because it is difficult to add static typing to a language that flexible. (Even in JavaScript this has proven difficult, as shown by the fact that TypeScript is known to be unsound.)


Also nothing in Ruby that's called a "DSL" is actually a "special syntax". It's necessarily all just method calls on objects, ruby has no actual mechanism to introduce new syntax. So I'm not entirely sure what the OP is meaning to mean.

I don't know about Scala.


You kind of know what he means. Ruby uses methods for things that look like syntax in other languages (eg the plus sign for addition) and lets you define them however you want. AND Ruby has the method_missing magic method, which means anywhere the language was expecting a method call you can put pretty much any tokens of your choice, and use metaprogramming to interpret it at runtime.

Those are things that people leaned into a lot ten years ago, and relatively little now. It might still make sense to, say, define the addition operator for colour spaces in your graphics library, but not to change the look of the language to the extent that rspec does.


Hmm. So C++ operator overloading is a DSL, at least in a sense. It lets you define things like + and * for vectors and matrices, so you can write your code using your usual notation for such things.

But it's a fairly limited DSL, because you can't introduce new (non-C++) syntax.

I hadn't thought of it that way, but I can kind of see it.


I would not call Rails “popular” in Europe at all. Some use it, sure.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: