Live data from Hacker News

Rhombus Language

rhombus-lang.org

121–130 of 161 posts

Re: Rhombus Language

#122
post #44

Earlier quoted context omitted.

Curious to read that because I’ve always had the opposite opinion of the above: Typescript looks nice to work with but the tool chain is horrible (this isn’t really Typescripts fault though, more a synonym of it having to compile to JS). Go looks horrible to work with (too simplified syntax) but is actually really nice because the tooling is (mostly) spot on and it’s simplified syntax weirdly helps with maintainabili…

I’m not sure about Go being full of footguns, but for one, a panic in any goroutine forcibly terminates the entire application.

I think that's the intention of a panic.. however there is still recover if you need to "catch" it.

Re: Rhombus Language

#123

Earlier quoted context omitted.

When the pattern `[Posn(x, y), ...]` matches a list of positions, since `Posn(x, y)` is followed by `...` the `x` is bound to a sequence of first coordinates and `y` is bound to a sequence of second coordinates. In the template the `Posn(y, x)` is followed by `...` so the same number of positions is produced as the common length of x and y.

What would be the corresponding syntax for matching and flipping only the first Posn? If I had to guess: fun flip_all([Posn(x, y), rest]): [Posn(y, x), rest] If I am correct then the only difference between flipping all and flipping just the first is `...` vs `rest`

Your version would expect a list of two elements, you use & to indicate that you're collecting the remainder of the list as in:

  fun flip_all([Posn(x, y), & rest]):
You'd need to amend the logic of the function body to iterate or recurse over the remainder. You'd also ended up with a nested list using your version but you can use & again to splice in the result, so if you wanted a recursive version of that it would be something like (skipping the base case):

  fun
    | flip_all([]): []
    | flip_all([Posn(x, y), & rest]):
        [Posn(y, x), & flip_all(rest)]
(not tested, don't have Rhombus available on this system but that should be correct)

If you really want flip_first it'd be:

  fun flip_first([Posn(x, y), & rest]):
    [Posn(y, x), & rest]

Re: Rhombus Language

#124
post #118

Earlier quoted context omitted.

I’m not sure about Go being full of footguns, but for one, a panic in any goroutine forcibly terminates the entire application.

https://100go.co/ has a great list of Go footguns

Most of the stuff on there is just talking about general programming mistakes. Eg overly nested code is a problem a developer can make in any language.

Sure there are some Go specific stuff in there. But the whole thing reads more like someone preaching an irrational hatred for something rather than a fair breakdown of genuine footguns.

Re: Rhombus Language

#125
post #34

Does anyone use Racket outside academia? Is it production ready (or friendly)? Especially Typed Racket.

Yes. I've been using it for 8 years. It has been production ready that whole time. I am not a user of Typed/Racket; the contracts system works well.

https://github.com/evdubs?tab=repositories&q=&type=&language...

Re: Rhombus Language

#126
post #54

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…

a big part of the racket project has been about establishing robust tools for transforming syntax. focusing on this use case has resulted in a much more generalized notion of pattern matching and template reconstruction than is typical. these kind of pattern/template combinators, as developed for racket/match and syntax-parse, might appear special-casey at first glance but from use i can attest that they are clean an…

I understand what it's doing, I just don't like that it does it.

Re: Rhombus Language

#127
post #79

Earlier quoted context omitted.

After 20 years of Ruby I didn't know (or didn't remember) that next can have an argument. I looked it up. Thanks. BTW, I never liked the _N arguments. Too cryptic. They make me stop and think on details instead of just read the code and concentrate on the important stuff. x.map {¦n¦ n + 3}.sum is immediately clear but I guess that it's very subjective.

In 3.4 you can now do x.map { it + 3 }.sum which I'm still getting used to

Even the same customer has projects with Ruby ranging from 2.7 to 3.4 so I'm using the oldest possible syntax. The changes in keyword args hit hard some projects. Luckily not the one I'm working on most of my time.

Re: Rhombus Language

#128
post #4

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, especiall…

I really wish they had kept the old C-like Honu syntax rather that the Python-like Shrubbery. If Rhombus is supposed to be an educational language, copy-pasting and trying out new code is going to be a important part of ecosystem, and indentation based syntax is not ideal for that.

C was my first language and braces confused the shit out of me. I found Python’s syntax much more intuitive when I learned it.

Re: Rhombus Language

#129
post #24

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 co…

This is not playing devil's advocate - this is a _VERY_ legitimate question. I'll go further and say that without a "killer app" (and/or strong corporate backer), a language doesn't typically take off nowadays, regardless how good it is ([edit] but to the point of another commenter - I do agree that "exploration" is a good enough reason; one doesn't need to write languages only with the goal of making them popular).…

I disagree strongly with Kotlin being a better choice than Java. Kotlin solves problems Java had 14 years ago while bringing along totally unnecessary syntax complexity. Moreover it is slow to compile and is essentially a proprietary language.

Re: Rhombus Language

#130

Earlier quoted context omitted.

What would be the corresponding syntax for matching and flipping only the first Posn? If I had to guess: fun flip_all([Posn(x, y), rest]): [Posn(y, x), rest] If I am correct then the only difference between flipping all and flipping just the first is `...` vs `rest`

Your version would expect a list of two elements, you use & to indicate that you're collecting the remainder of the list as in: fun flip_all([Posn(x, y), & rest]): You'd need to amend the logic of the function body to iterate or recurse over the remainder. You'd also ended up with a nested list using your version but you can use & again to splice in the result, so if you wanted a recursive version of that it would be…

In Haskell:

  flip_one Posn(a,b) = Posn(b,a)
  flip_first p:ps = flip one : ps
  flip_all ps = map flip ps
To my taste that's a lot nicer
Post reply on HN