Hi everyone,
I love Python, but I love Racket even more.
Recently, I tried to bring an f-string-style template string mechanism into Racket in racket/racket#5512.
Some people in the community seem to feel that, since Racket already has at-exp, adding f-strings may be unnecessary. I understand that view, but I still think f-strings solve a different usability problem.
For simple everyday interpolation, I believe the friendliness of f"hello {name}" is hard for at-exp to match. If this syntax were available directly in the REPL and in the default racket language, I think it could make Racket feel more approachable and pleasant for scripting, teaching, and quick experiments.
That is why I would really like to get practical user feedback: after having this mechanism available, does writing Racket code feel more convenient, natural, or comfortable?
A small usage note: in my build, f-string syntax is enabled in the REPL. In source files, use: #lang tstring racket If you want to use it together with at-exp, currently you need: #lang at-exp tstring racket
The reverse order currently fails. This is a known bug and I plan to fix it in the next package update. Sorry that I cannot publish package updates too frequently.
I have also been thinking about something similar in spirit to Haskell’s Sequence, so I introduced a new type called pvector for Racket. I would love to hear whether this direction feels useful, what APIs people would expect, and where it fits or does not fit with existing Racket data structures.
Another thing I want to mention is Rhombus. I really like its syntax. Even though I am personally a committed Lisp/S-expression user, I think that if Rhombus-style syntax can help more newcomers enter the Racket world, that is absolutely a good thing.
With all that in mind, I made a set of changes based on the Racket v9.2 release branch, integrated the features above into my private build, and packaged it for several platforms. The currently most reliable version is v9.2.1.3.
I would be very grateful if anyone is willing to try it and share feedback. Constructive discussion, criticism, suggestions, bug reports, security reports, and usability comments are all very welcome.
Package/archive repositories:
Note: Based on @soegaard's suggestion, I also plan to publish this as a standalone package, while continuing to maintain it as an internal library in my personal Racket builds. So people who are interested in these features can try them either through the package or through the prebuilt distribution