Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I use it professionally. My favorite is its seemingly complete lack of bad behavior:

"3" + 1 is neither "4", "31", nor 4. It's illegal.

0 is not false, causing endless confusion on filters and &&s.

For loops don't alter the iterated value within a closure to the max value when it's finally called.

And some positives:

Immutable/functional is the default, but mutability is easy too.

Nice optional, keyword, and variable arity support.

Straight forward multithreading, semaphores, shared state, and unshared state.

Excellent module system:

- renames both in and out, including prefixes, all applied to arbitrary scopes of identifiers (I may be using inaccurate terminology)

- nested submodules

- automatic tests and/or "main" submodules

.....etc.......

If I could be grated a wish though it would be for nice struct syntax, but I think that's in Racket's successor Rhombus; haven't personally tried it yet.

I also sometimes wish it was slightly Haskell-ier in various ways, as did the talented individual who created Hackett.

If I were to guess why it's not used, it's because it's not used, which has a kind of downward-spiral force thing going on with it. If you're a random guy in charge of 200 dudes at BigCo, your first thought probably isn't "We should rewrite this whole thing in Racket!", it's probably more like "We should fire everyone and have Claude rewrite our codebase into Rust!" and tell your boss you saved 200*0.5M a year and ask for a comparative bonus. But if you're solo and in charge of designing, implementing, and maintaining a system with 1 or 2 people over the next 20 years, you can use whatever language you want, and Racket's a pretty good choice.



> nice struct syntax

I am curious how you would change the struct syntax?


I don't have the creds to give a definitive answer, but I like C structs, JS dicts, Java object access, Haskell lenses, etc -- any kind of dot syntax.

Default Racket: (potato-skin-color apotato)

JS: apotato.skinColor

The extra potato upsets me. Some libraries exist to address this but I believe they all have caveats.

With copying or mutation, it's even worse:

Racket copy: (struct-copy potato apotato [skin-color 'brown])

Racket mutate: (set-potato-skin-color! apotato 'brown)

JS copy: { ...apotato, skinColor: 'brown' }

JS mutate: apotato.skinColor = 'brown'

None of this really ruins the language for me, considering pros vs cons as a whole, but sometimes I'm slowed down in that by the time I finish mentally spelling out and typing the struct accessing I half forget the context I was in, and in general I'm sensitive to "eye bleed". Sometimes Racket looks like:

(define define match-define define define-values define begin cond define define)

when the real meat of the algorithm is more like:

cond

...and where Haskell's "where"s, "|"s, and "="s shine.

I'm sure I've over-answered your question but it's the holidays and I'm bored :)

edit: Since Racket uses dot already, it would probably have to be a different character, or the other way around.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: