from Hacker News

Rhombus Language

by swatson741 on 3/18/25, 1:37 AM with 158 comments

  • by pmontra on 3/18/25, 6:00 AM

    The examples on the home page are a nice way to quickly show the features of a language. I'll check the documentation to see how to work with files, make HTTP calls, parse JSON.

    It's the first time in more than 10 years that I actually feel like trying a new language. The last time was Elixir. Since then I had to use Lua (hobby project) and Python (work) but I don't enjoy them much. I would have skipped them if I hadn't have to use them. Before Elixir I enjoyed Ruby, before that it's been Perl 5 in the 90s. Everything else I used in that period and before was because I had to (C, Java, PHP, JavaScript/Node) and I skipped many other mainstream languages because they didn't look nice to work with (Go, Rust, TypeScript.) I still have to see what's writing and running a Rhombus programs looks like so I might discover that it's not so nice after all. I'm hopeful.

  • by dexterlagan on 3/18/25, 11:21 AM

    I have used Racket in production for a decade and a half, with great success. Racket belongs to a sort of invasive species equivalent in languages, in the sense that once it has a hold on you, all other languages, old and new, vanish from your mind. The elegance of Scheme married with the power of hygienic macros does a great job at tricking your mind into believing Paul Graham's Hundred-Year Language idea again.

    What if Racket and Python had a child? Rhombus represents much, much more to us Racketeers. It may quite possibly be the crown jewel of multi-paradigm meta-programming languages and most importantly, a possible solution to the 's-expression barrier'. Who knows, it might even make a dent in the LISP curse. And we were all hoping for this. We were all waiting for this. And so I applaud the enormous effort involved, and I hope it inspires people to try a different approach to programming, and to language in general. It represents an impressive achievement in terms of elegance, pragmatism/practicality and efficiency in a language built atop a very solid foundation, coming from one of the greatest lineage of programming languages in history.

    Like many others, I have been waiting for a killer app, a real showcase of the power of language-oriented programming. I was secretly hoping Rhombus would become a catalyst to the production of something great. While the emergence of LLMs presents challenges, it doesn't have to seal the fate of amazing purely and proudly human innovations like this one. My GitHub account may be filled with Racket code few will ever use, but Rhombus gives me new inspiration.

    Sure, the future of programming might involve neural networks programming CPUs and GPUs directly. We're getting there. Yesterday we were programming with cryptic machine language, today we program computers with increasingly natural syntax. Tomorrow we might just tell machines what we need. But that doesn't make what we're doing now any less significant or exciting.

    We programmers aren't going anywhere just yet, and many of us will keep writing code because we love it, not just because we have to. And now we have this pinnacle of human ingenuity in the form of a beautiful language, a love letter to the art of programming by humans, for humans. Thank you.

  • by lygaret on 3/18/25, 3:25 AM

    This is racket's [rhombus], which might be an interesting second link here; it's a scheme, underneath, with the full power of Racket libs available.

    [`shrubbery`], the replacement for s-exprs, is pretty interesting, expanding s-expr simply with grouping, and then a separate infix-pass on top. I've been playing with using it as the basis for a separate language; it's in an interesting place in the AST space, especially given the forethought put into macros.

    [rhombus]: https://docs.racket-lang.org/rhombus/index.html

    [shrubbery]: https://docs.racket-lang.org/shrubbery/index.html

  • by rednafi on 3/18/25, 3:17 AM

    The syntax looks clean, akin to Python, but with terser record types. This would make a nice config or an embedded language like Lua.

    One thing I’d appreciate here is a “Why Rhombus?” page, even if the rationale is simply that it’s fun.

    Edit: Turns out there’s a goals[1] page. Rhombus is trying to replace Lisp’s parenthesis-heavy syntax with something cleaner while keeping Racket’s powerful macro support.

    [1]: https://rhombus-lang.org/goal.html

  • by wavemode on 3/18/25, 3:45 AM

    From the 2nd example:

    class Rect(left, top, right, bottom)

    fun rect_like_to_rect(v): match v | Rect(_, _, _, _): v | {"LT": [l, t], "RB": [r, b]}: Rect(l, t, r, b) | {"TL": [t, l], "RB": [b, r]}: Rect(l, t, r, b)

    rect_like_to_rect({"TL": [0, 2], "RB": [10, 5]}) // ⇒ Rect(0, 2, 10, 5)

    Isn't this wrong? I'd expect to see Rect(2, 0, 5, 10) instead.

    It also seems like "RB" was meant to be "BR".

  • by mapcars on 3/18/25, 12:53 PM

    Looking through the examples, macros and pattern-matching, for me that would be impressive like 10 years ago.

    If you want to see really innovative, readable and powerful language check out Red. While the language development seems to be ceased, the ideas (coming from old proprietary Rebol language) of working with code and data go much deeper than just macros: it has built-in DSL (called parse) for making DSLs on the fly and not just pre-runtime code manipulations. https://www.red-lang.org/

    And there is XL language which might have even more powerful extensibility features, like adding types or pattern matching or asynchronous processing. Sadly I couldn't compile and try the only implementation it has, only judging by the docs explaining its ideas. https://xlr.sourceforge.io/

  • by coolio1232 on 3/18/25, 4:31 AM

    This actually looks good. It's like a less-obtuse Haskell. At a glance the features seem to be just the right mix of functional programming paradigms and standard imperative programming.
  • by true_blue on 3/18/25, 3:17 PM

    I think it's clever how the logo is a different shape from Racket's to fit the name of the language, but they kept the same colors and kept the lambda in it.
  • by Y_Y on 3/18/25, 9:39 AM

    I've been cautiously optimistic about Rhombus since the initial "Racket 2" controversy. I'd have preferred they went with something more like Wisp or Wraith, but it could be a lot worse.

    I am somewhat troubled by tricks that are "too magic", like this example from front page:

        class Posn(x, y)
     
        fun flip_all([Posn(x, y), ...]):
          [Posn(y, x), ...]
     
        flip_all([Posn(1, 2), Posn(3, 4)])
        // ⇒ [Posn(2, 1), Posn(4, 3)]
    
    
    Why should the later Posns be flipped? That's certainly not what I would expect.

    (Then again being too magic is working well for Python, e.g. that a<b<c thing)

  • by Tewboo on 3/18/25, 8:28 AM

    Interesting to see a new language like Rhombus popping up. Always curious to see what innovative features it brings to the table.
  • by orthoxerox on 3/18/25, 7:03 AM

    I am going to play the devil's advocate. What problem does Rhombus solve? An approachable syntax is a necessary, but not sufficient requirement for mass adoption.

    According to the goals page, its other major feature is an extensible syntax. Why should I prefer it over, say, Scala? Scala has syntax macros, it runs on the JVM and can access Java's massive library of libraries, it has been used to implement large and complex projects like Spark and Lichess, what's that niche in which Rhombus can defeat Scala or Rust or Elixir?

  • by zerr on 3/18/25, 8:28 AM

    Does anyone use Racket outside academia? Is it production ready (or friendly)? Especially Typed Racket.
  • by eviks on 3/18/25, 7:50 AM

    How hard would it be to uniquely extend the language to make *fun* into *fn* and *...* into a single letter *…*?

        fun all_same([str0, str, ...]):
          all(str0 == str, ...)
  • by datadeft on 3/18/25, 8:45 AM

    Is it possible to have Hindley–Milner type system for a LISP?
  • by anacrolix on 3/18/25, 10:57 AM

    This is good to see, but I think too much effort is being used to maintain the prefix style function application. As a result a significant amount of the novelty is just mapping syntax from new to old. Special cases, special cases everywhere, even in an implementation like this which is specifically attempting to allow you to make your own "special" cases.
  • by fithisux on 3/18/25, 5:37 AM

    Is this a reincarnation of Pyret?
  • by freilanzer on 3/19/25, 9:25 AM

    Is it statically typed, like Ocaml?