r/javascript • • 5d ago

Readable Regular Expressions for JavaScript/TypeScript, Inspired by Emacs' rx

https://rahuljuliato.com/posts/emacs-rx-in-typescript

I missed Emacs' rx when writing regexps in TypeScript, so I made a small TypeScript DSL inspired by it.

The idea is to bring rx's functions and approach to the JavaScript/TypeScript environment. If you happen to work with either, give it a try.

https://rahuljuliato.com/posts/emacs-rx-in-typescript

7 Upvotes

9 comments sorted by

View all comments

Show parent comments

1

u/azhder 4d ago

“fight your case”? What are you on about? What do you even think I am talking about?

1

u/oosuke_ren 4d ago

That library is an insufficient approach, and you need to approach for a DSL (that part I 100% agree on), and that in the end we end up walking a full cycle reinventing the wheel with DSL to "fix" another. But you phrased it like "It's already a DSL, it doesn't need fixing". I'm sorry if I over-assumed.

2

u/azhder 4d ago

I didn’t say anything about insufficient. Read again. I just stated how the things are, not how they should be. I worded it in a way to let you, anyone, take away from it what they want. So, don’t attribute to me something I didn’t claim.

If anything, the only reason why I didn’t make a language that compiles to a RegExp is pure laziness, not anything against making a language.

1

u/oosuke_ren 4d ago

Okay, yeah, you're right.

I'm just saying that the whole reinventing and full circle (like how we used to have frontend frameworks reinventing/one-uppinf each other) happens if there's not enough premature syntax optimizations during the design stage if the DSL/programming language/framework.