What are some benefits that rhombus development has brought to racket?

recently, someone said this on the racket discord server and I would like to know more about it.

… the rhombus project is approaching four years and it has brought nothing but benefits to Racket

what are some benefits that rhombus development has brought to racket? any part of racket is fair game, including DrRacket.

here's a recent one that was mentioned on the discord: DrRacket got an improvement to how it does define pop-ups. I don't really understand the improvement since I don't use Dr racket, but it sounds like each lang can change how this pop-up works now. If I'm missing something, feel free to explain in more detail.

2 Likes

I've been meaning to do a deep dive into Rhombus now that it's been worked on for a few years. But as an outsider to the project I'd say...

The Rhombus Language is a test for the whole ideology of Racket. Racket is a good Scheme don't get me wrong, but there are plenty of other good Schemes out there to use. One of Racket's differentiators has always been about DSL's and new programming languages. By creating a fully fledged language on top of Racket, that might at some point supplant the main language "Racket" we are seeing out in the public the full capabilities of this Lisp that is supposed to be a language design platform. If the Racket team can't make it work with industry leading knowledge in programming language theory, what chance do we have?

At the end of the day putting all the work to create a new DSL or new programming language has to have some pay off. In @mflatt's Google Group Post on Racket2 he said

Partly, I believe that a syntax with infix operators, fewer
parentheses, etc., would be better. That's a matter of opinion, but at
least it's an opinion backed by enough experience with parentheses
that it can't be written off as uninformed. More significantly,
parentheses are certainly an obstacle for some potential users of
Racket. Given the fact of that obstacle, it's my opinion that we
should try to remove or reduce the obstacle.

A language with less barriers to entry in it, means more people in the Racket Eco system and more potential contributors. The success of Rhombus means that we get less people commenting on my post in /r/ProgrammingLanguages with "I didn't know I could design a language on top of Racket". Some of these benefits are still forthcoming, but by working through this with a language like Rhombus, we are stress testing one of Racket's biggest differentiators amongst programming languages.

One of the main things I'd like to see come out of this project as I continue to watch it is...
How will they address the "Will I need to know Racket to work in Rhombus?" Problem

This is the problem with a lot of great languages, I.E Kotlin, F#, Clojure etc. They are called Guest Languages for a reason. Some of these pain points are inevitable, but I think we can still do better at getting people to learn Rhombus without ever touching Racket

2 Likes

I think you misunderstood me. it sounds like you're trying to answer "what is the benefit of rhombus" or "what is the point of rhombus". I am not asking those. I am asking how racket itself has been improved due to work on rhombus. what changes has rhombus caused in racket that improved racket?

Maybe I should provide more context from our discussion in the discord. We were discussing an article that was critical of racket. one of the criticisms was working on a whole new language makes the future of racket uncertain. one response was:

  • working on rhombus doesn't mean racket falls to the wayside because it's all on the same platform for languages. it's not a zero-sum game because both languages are running in the same platform. they're not separate products.
  • and, working on rhombus causes improvements in racket. beneficial changes are made in the rest of racket as part of the work to support rhombus.

that was my understanding of what was said at least. I want to explore that response more and learn about it, so I am asking about examples of those improvements. the link I gave in my original post is an example. it's a way in which doctor racket was improved due to work on rhombus.

The introduction of the configure-expand submodule is yet another example.
https://docs.racket-lang.org/reference/running-sa.html#(part._configure-expand)

Racket: https://github.com/racket/racket/commit/38a7d658439d0817d03da797122cd2ff3329df2e
Rhombus: https://github.com/racket/rhombus-prototype/commit/5635363f8a9c35c622298c1f3f405a668e67f35d

The addition of racket/hash-code is also from Rhombus.
https://github.com/racket/racket/pull/4546

2 Likes

Found two more after searching for Rhombus in racket/racket.

  1. Configurable error messages for syntax/parse, syntax/parse/report-config.
    https://github.com/racket/racket/pull/4652
  2. The equal-always? function that tests whether two possibly mutable values will always be equal.
    https://github.com/racket/racket/pull/4076#ref-issue-468212209

Looks like quite some of the improvements are motivated by the macro-extensible non-S-expression syntax that Rhombus needs.

2 Likes

There's also the #:do and #:splice keywords in for loops, those were motivated by Rhombus.

3 Likes

What are #:splice and #:do? I'm not finding them with a medium-effort google.

1 Like

https://docs.racket-lang.org/reference/for.html#(form._((lib._racket%2Fprivate%2Fbase..rkt)._for))

#:do allows definitions & effectful expressions in for iteration clauses

> (for ([i '(1 2 3)]
        #:do [(define neg-i (* i -1))]
        [j (list neg-i 0 i)])
    (display (list j)))
(-1)(0)(1)(-2)(0)(2)(-3)(0)(3)

#:splice abstracts over for iteration clauses as macros as in https://docs.racket-lang.org/reference/for.html#(form._((lib._racket%2Fprivate%2Fbase..rkt)._define-splicing-for-clause-syntax))

> (define-splicing-for-clause-syntax cross3
    (lambda (stx)
      (syntax-case stx ()
        [(_ n m) #'([n (in-range 3)]
                    #:when #t
                    [m (in-range 3)])])))
> (for (#:splice (cross3 n m))
    (println (list n m)))
3 Likes

I think the most important thing that Rhombus brought to racket is binding spaces:
https://docs.racket-lang.org/reference/syntax-model.html#(tech._binding._space)

5 Likes

Can you elaborate? I read what you linked and I understand as something to do with introducing a scope. Why do you feel this is the most important thing that rhombus has brought to racket?

Why do you feel this is the most important thing that rhombus has brought to racket?
Well,

It's a general tool that can be used to built other features.
It would be perfect if you wanted to implemented dot notation for example.

2 Likes

Not yet merged improvement:

5 Likes