11 ms·
Rhombus: Macro-extensible language with conventional syntax built on Racket
- TwentyPosts 2y agoI feel like a link to a 'pitch' or description of the Rhombus language would've been more insightful for most of us. Even being familiar with Racket, I don't know what Rhombus is.
- metadat 2y agoAgreed. Here's the link I found more informative: https://docs.racket-lang.org/rhombus/index.html https://docs.racket-lang.org/rhombus/index.html
- adastra22 2y agoI didn't. Still not a single explanation of what the language is / what its designers are trying to do.
- philipswood 2y agoAlso not sure. I'm guessing it's some kind of Lisp bracketectomy - i.e. Lisp without the parentheses.
- Tuna-Fish 2y agoYes. It's a bracketectomy on Racket that's designed to (unlike previous bracketectomies) retain all the metaprogramming goodness of Lisp.
- dualogy 2y agoParens-less(er) Lisp, whitespace/indentation-based s-expressions.
- BoingBoomTschak 2y agoLooks like "yet another Lisp without s-exprs for babby ducks". I'd probably go the Julia route if this is what I wanted, personally.
- adastra22 2y agoYou are being down-voted for the snark, but there is point there. This seems to be "people use Python because of the whitespace, so let's remove parenthesis." Which if true, is (1) vastly missing the point, and (2) this project isn't really exploring any fundamentally new areas of language design then. I was kinda hoping to see this was the next generation of Lisp language design, but it appears to be just a different syntax.
- fgh 2y agoThe OOPSLA paper is more interesting: https://dl.acm.org/doi/pdf/10.1145/3622818 https://dl.acm.org/doi/pdf/10.1145/3622818 Abstract: Rhombus is a new language that is built on Racket. It offers the same kind of language extensibility as Racket itself, but using conventional (infix) notation. Although Rhombus is far from the first language to support Lisp-style macros without Lisp-style parentheses, Rhombus offers a novel synthesis of macro technology that is practical and expressive. A key element is the use of multiple binding spaces for context-specific sublanguages. For example, expressions and pattern-matching forms can use the same operators with different meanings and without creating conflicts. Context-sensitive bindings, in turn, facilitate a language design that reduces the notational distance between the core language and macro facilities. For example, repetitions can be defined and used in binding and expression contexts generally, which enables a smoother transition from programming to metaprogramming. Finally, since handling static information (such as types) is also a necessary part of growing macros beyond Lisp, Rhombus includes support in its expansion protocol for communicating static information among bindings and expressions. The Rhombus implementation demonstrates that all of these pieces can work together in a coherent and user-friendly language.
- mkl 2y agoThis says more of that sort of thing: https://github.com/racket/rhombus/blob/master/resources/plan.md https://github.com/racket/rhombus/blob/master/resources/plan...
- stodor89 2y agoIs that the "Racket 2" thing they wanted to make some time ago?
- pas 2y agoYes
- int0x29 2y agoIt would also help to have such a description in the README
- noelwelsh 2y agoThe pitch, compared to Racket, is conventional yet still extensible syntax.
- xscott 2y agoI'll have to read about why they made the choices they made, but it reminds me of going to a microbrewery: You tell them you like simple (American) macrobrews, and they say they have just the thing. What arrives is a light lager that tastes awful because they think macrobrews beers are awful. So they made an awful beer that doesn't taste like a macrobrew. I don't think Rhombus is going to appeal to people that are comfortable with Python, C, Java, Go, JavaScript, etc... It's got infix, but it's cryptic. It seems like a step back from StandardML or Ocaml. Maybe there's a justification in terms of how the macros work. Maybe they're poisoning the well to make Lisp syntax more appealing. I'll try to reserve judgment, but so far I'd rather program in Scheme/Racket than this.
- pas 2y agoAs someone who gets the shakes from looking at too many parenthesis I think it's a great step in the right direction. A few weeks ago I went through the "GUI demo" source, and it's not bad. Of course just reading it doesn't tell much about what's the IDE support, how easy it is to figure out the arguments/types. (But it's rhombus/static, which is encouraging!) https://github.com/racket/rhombus/blob/master/gui_demo.rhm https://github.com/racket/rhombus/blob/master/gui_demo.rhm
- noelwelsh 2y agoI don't think the Racket/Rhombus developers are really trying for adoption. They're trying to push the field forward via their research. Creating these useful programming languages is how they validate their research, but the end goal is not to grab a large share of working developers but to grab mindshare of the few developers who create the future of programming. In this they have been quite successful.
- xscott 2y ago
- deleted 2y ago[deleted]
- smokel 2y agoRhombus appears to be a relatively new language, built in the Racket ecosystem, with similar capabilities such as macro expansion. Racket uses a Lisp-style syntax, and Rhombus uses a more Python-like style that could attract a wider audience.
- luckymate 2y agoWhat’s the gain from using that over just using python?
- anonzzzies 2y agoI don't think Rhombus is python style. And this won't convert anyone anyway; it's experimenting with new language constructs and such which is what racket is used for by most who use it. In many years from now, the lesson learned by these experiments might end up in a new language that might get converts and even rival python/js (I hope so, I find both terrible).
- kamaal 2y agoI was skeptical about Rhombus in the past. But as it turns out making new programming languages is the whole point behind Racket. This not supposed to be a production use language, think of it more like used to teach, and experiment with programming language features. To that end, it will be used by its target audience(i.e, teachers and researchers)
- 1attice 2y agoA lot of folks (including me) find Python limiting for non-trivial use cases. The One Python Way was a great selling point in 2004, but the thing is, it's still basically the same Way in 2024. So, I hope you like nerfed lambdas and inheritance
- 1attice 2y agoExpanding on this point (because it's important): A lot of folks (including me) find Python limiting for non-trivial use cases. The One Python Way was a great selling point in 2004, but the thing is, it's still basically the same Way in 2024, and the fact that the language has been designed so exhaustively to ensure that there is only one correct way to do stuff, there has never been room for evolution. (Insufficient entropy!) I'm going to compare it to JavaScript/TypeScript, because it's what I know best in 2024, and because it's an engaging contrast; yet the take-home message is also applicable to other languages, such as Rhombus (which looks cool!) Python feels timeless to me, like Roman majuscules. It was, in its day, brilliant: cleaner than Java, saner than Perl, and just so, so hackable. The strong Pythonic cultural rejection of Perl's 'more than one way to do it' dictum was powerfully clarificatory; we didn't have StackOverflow, and the _good_ technical resources were still all in physical books, so being able to learn one pretty-good way of expressing a concept or pattern was magical. But, like roman majusucles, Python didn't evolve, because it didn't have to. The marginal cost of change threatened the original value proposition, so it just didn't really ever happen. By contrast, while e.g. JavaScript had to evolve, because it was gobsmackingly bad, the necessity of that evolution has made made JavaScript (as a community and language) open to variation, change, competing paradigms, and imports from academe and research. Evolution loves a mess. TypeScript, for example, happened nearly overnight, and as a result of it and other innovations, I can spend my day working blissfully in algebraic types, doing frigging set theory to do precise type hinting, and passing around pure functions and immutable structures. My code runs everywhere, and my coding style is always changing (improving!), and the only real price I've had to pay is learning some regrettable nonsense about an extra '=' in my comparison operators, and maybe the idiocy of having both `undefined` and `null` types. Whereas, when I peep the pythonista channels at my work, I notice they are still having essentially the same conversation about eliminating the GIL that I remember them having in 2007 (yes I am old.) Which is not to say that Python is _bad_, per se; there are obvious advantages to having an imperfect but opinionated lingua franca, and I'd sure rather be thrown into an unfamiliar Python codebase from 10 years ago than an unfamiliar JavaScript codebase of an equivalent age. Yet I'll warrant that Python's long summer of success, combined with its one-way-to-do-it culture, close the mind and the imagination, and will eventually make it less fit-for-purpose than its competition. It will remain in use, and it will even find new contexts (machine learning, say) but 'the code part of the codebase' will be done in other languages. I suspect Python will, thanks to its exceptional readability and regularity, become a configuration language --- a part of the UI, essentially, a sort of shell. It will also continue to be a language used to teach programming. Hanging on here and there, sort of like how Latin hangs around in biology and medicine. But legacy Python codebases, thanks to that very readability, will probably be rewritten sooner rather than later. Standards (Latin, Python) are _useful_, and _timeless_ standards are some of the most valuable artifacts humans have ever produced. But it's the Innovator's Dilemma for sure.
- anonzzzies 2y agoFor people, like me, who don't know Rhombus: https://docs.racket-lang.org/rhombus/index.html https://docs.racket-lang.org/rhombus/index.html Cannot see if/how this would win souls over Lisp-y syntax, but I'm a fan of the latter over most, so I'm probably very wrong.
- cocok 2y agoI stopped at 1.1 Notation. Full of arbitrary-looking decisions on which characters can be used for what. It's 2024, and we still don't have a string notation that doesn't use the same character for opening and closing delimiter. If I start parsing from an arbitrary offset in the code, I can't say whether a double quote I read is the beginning of a string, or the end of one. I have to either resort to heuristics, or parse from the beginning of the file (at least once; and then cache offsets known to be outside a string). Something like "() would be nice. Still the familiar double quote, but the grouping is defined in a grammatically-superior way. Also, still no identifiers that can start with a digit. Most of the mainstream languages have such complex grammars, probably requiring hand-coded parsers, but I can't have a "52cards" identifier. Is this really that hard compared to everything else? Now, I'm self-taught and all. Maybe I'm missing something and the professors are right.
- ansible 2y ago> If I start parsing from an arbitrary offset in the code, ... Why would you ever do that? What's the point? There are many other examples, but in C and C++, if you don't start parsing at the beginning, you're definitely going to get many things wrong. What if you start parsing in the middle of an identifier? How can you possibly expect to get something useful from that?
- HexDecOctBin 2y ago> Why would you ever do that? What's the point? Syntax highlighting code visible on the screen
- 2y ago
- OriPekelman 2y agoActually looks quite interesting. syntax looks like: fun | is_sorted([] || [_]): #true | is_sorted([head, next, tail, ...]): head .<= next && is_sorted([next, tail, ...]) is_sorted([1, 2, 3, 4, 5]) is_sorted([1, 2, 30, 4, 5]) a bunch of ways to express blocks, pattern matching and macros. The class facilities also look very nice. other than some indentation it doesn't feel pythony at all (which for me is a good thing!) more like an Elixir feel (cute syntax for some great concepts behind) see https://github.com/racket/rhombus/blob/master/demo.rhm https://github.com/racket/rhombus/blob/master/demo.rhm
- adastra22 2y agoLooks like Haskell.
- trealira 2y agoOr like Standard ML. But it's interesting, since I hadn't seen that part yet, only the loop part and some of the dynamic typing. for List: each i: [1, 2] each j: ["a", "b", "c"] [i, j] > [[1, "a"], [1, "b"], [1, "c"], [2, "a"], [2, "b"], [2, "c"]] for (i: 1..4): "number " +& i ~into List > ["number 1", "number 2", "number 3"] for: each: friend: ["Alice", "Bob", "Carol"] index: 1..4 println(index +& ". " +& friend) 1. Alice 2. Bob 3. Carol It gave me the impression of more of a cross between Scheme and Python.
- aeonik 2y agoYes, I also got Python vibes. That behind said, I'm digging infix less and less over time, and I'm actually starting to crave forth syntax, just got the complete lack of punctuation... but, I actually really like what they have going here. Seems nice and minimalist, while meeting consistent and clean.
- scotty79 2y agoFor a person that doesn't know racket, Haskell or any ML it looks unnecessarily convoluted. My most charitable take is that it solves some problems I never seen a computer language have.
- JTyQZSnP3cQGa8B 2y agoFor those who are familiar with the Racket environment, is it easy to create standalone executables like Go? The Python syntax with the power of Lisp could be a fun thing to use on a CI pipeline.
- noelwelsh 2y agoYes. See https://docs.racket-lang.org/raco/exe.html https://docs.racket-lang.org/raco/exe.html
- JTyQZSnP3cQGa8B 2y agoThanks. I did DevOps for a few years and always used Python instead of a mix of PowerShell and Bash, but an alternative to Python could be nice.
- soegaard 2y agoAlso, check out: https://docs.racket-lang.org/zuo/index.html https://docs.racket-lang.org/zuo/index.html
- arthurcolle 2y agoI remember learning what a rhombus was in elementary school. Good, simpler times.
- BaculumMeumEst 2y agoDude totally. And now my 3 year old lights up when we draw rhombuses (rhombi?). Such a fun shape.
- Y_Y 2y agoThe Latin plural is rhombī and so as is typical, both "rhombi" and "rhombuses" are used.
- soegaard 2y agoThe reference manual for Rhombus is here: https://docs.racket-lang.org/rhombus/index.html https://docs.racket-lang.org/rhombus/index.html Note that Rhombus is still a WIP, so a guide (and tutorials) will appear later.
- pas 2y agoAnd here's a non-trivial example of how it looks/feels. https://github.com/racket/rhombus/blob/master/gui_demo.rhm https://github.com/racket/rhombus/blob/master/gui_demo.rhm
- deleted 2y ago[deleted]
- dang 2y agoAll: we've changed the URL from https://github.com/racket/rhombus/discussions/521 https://github.com/racket/rhombus/discussions/521 to the base link suggested by commenters. Thanks! Also related: Rhombus-in-the-Rough - https://news.ycombinator.com/item?id=36075516 https://news.ycombinator.com/item?id=36075516 - May 2023 (1 comment) State of Rhombus (programming language) - https://news.ycombinator.com/item?id=30314109 https://news.ycombinator.com/item?id=30314109 - Feb 2022 (17 comments)
- andrewflnr 2y agoI don't know, to me the change in the phase of the project is the news, not just the fact that it exists...
- ashton314 2y agoI’ve written a library as well as a toy compiler in Rhombus. I occasionally work with Matthew Flatt. I’m happy to try to answer any questions! :) One of the biggest things that make Rhombus an interesting language is its “shrubbery” notation. In languages with macros, you typically get faced with a trade-off: if you want to operate on an AST, then the syntax going into the macro needs to be parsable by the host language, thus limiting what kind of syntax you can have in a macro. On the other hand, you can pass a token stream, which gives you a lot more flexibility; the problem now is that you need some parser to recover binding syntax when you want it, which complicates things. Rhombus does a little bit of parsing, but leaves subterms unparsed until later. This gives you flexibility in your macro syntax without the complications of using a raw token stream. There’s a lot of other interesting stuff like its ability to bind macros in different spaces (a macro can have one expansion when used on the left of an assignment and a different one in expression position), the ability to attach static information to identifiers at compile time and have that propagate to use sites, etc. Here’s my compiler: https://codeberg.org/ashton314/rhombus-compiler https://codeberg.org/ashton314/rhombus-compiler Here’s the library: https://github.com/ashton314/rhombus_dyn https://github.com/ashton314/rhombus_dyn Motivation for building the library: https://lambdaland.org/posts/2024-07-15_type_tailoring/ https://lambdaland.org/posts/2024-07-15_type_tailoring/