
The Rosie Pattern Language - rajiv_abraham
http://rosie-lang.org/about/
======
devchix
I say this so often: "I can't believe it's $year and we're still using regex!"
So when I see "new pattern matching language" my eyes light up and I run over
there -- but there's no example, no docs, even where it says "examples", and
"docs", and it's hard to find anything I can use. I'm sorry, am I a vulgar
entitled twit for not finding the spoon right away?

Regex is terrible to read. Give me an example, things we frequently match for,
IP, credit card number, dates ... I read the example for date parsing, I'm ...
not sure what the equiv is? I suggest the authors put up a Rosetta stone of
sort, eg. in regex-speak: [0-1][0-9]-[0-3][0-9]-201[0-9], in Rosie-speak: xyz.
What about capture group, that's what makes regex powerful, not just matching,
that and the look-ahead look-behind.

Meta-comment: regex is buried in everything significant that I work with, it's
buried in grep, the language libraries, Splunk. It's going to be hard to
dislodge, there's a deep moat because the tools and common use cases are ugly
but well-understood. Why _are_ regex still being used? Why has nothing better
come along? How would I even regex-match extended Unicode?

------
wodenokoto
If it is so much better and easier to read than regex, why not show any
examples? Even the examples page is void of any examples.

~~~
jackric
A canonical regex pattern vs Rosie pattern should be front and center on the
landing page. I want to immediately judge whether it's worth my time to read
more.

~~~
HelloNurse
I need to scroll about halfway through the reference documentation page to see
what appears to be pattern-related syntax. Starting with a _module system_ is
really strange.

------
platz
Seems like a middle ground between regex and a parser combinator library.

Also there was a strangeloop talk by it's creator
[https://youtu.be/MkTiYDrb0zg](https://youtu.be/MkTiYDrb0zg)

------
paulddraper
I've look for a while at this, and have come to this conclusion:

At the time I need a multi-line pattern language, I just whip up a FSM-like
program in code. And I'll continue to do that.

~~~
ken
It's also a command line tool, and a library of useful patterns.

    
    
        curl -sL news.ycombinator.com | rosie grep -o subs net.url
    

How many LOC is your ad-hoc "FSM-like program", and have you done correctness
and performance testing on it? If I had a nickel for every incorrect email
validity checker I ran across, I'd have an awful lot of nickels.

~~~
paulddraper
> If I had a nickel for every incorrect email validity checker I ran across,
> I'd have an awful lot of nickels.

I won't argue with that. Email is a clusterf---. To make a validator to be
truly "correct" is essentially impossible. Three RFCs have successively
created standardized regexes and the latest RFC 5322 still has a bug. [1]

You'd have to convince me that you'd be significantly fewer nickles had they
used Rosie.

> library of useful patterns

That's cool. I certainly use a library if I need to validate emails.

[1] [https://stackoverflow.com/a/201378](https://stackoverflow.com/a/201378)

------
danmg
Why use a 'better regex' when PEGs exists?

~~~
saghm
FTA: "RPL is based on Parsing Expression Grammars, which are more powerful
than regex, obviating the need for “recursive regex” or “regex grammars”, both
of which are ad hoc extensions and are not commonly supported in regex
libraries."

------
languagehacker
It's really disingenuous to sell your project as a replacement for regular
expressions when it has greater expressive power than them in the Chomsky
hierarchy.

~~~
HelloNurse
It's a replacement for regular expressions _in purpose_ , not according to
theoretical equivalence criteria.

The main selling points appear to be naming patterns in order to reuse them
from libraries, functions, and more systematic grouping and lookahead
operators: increased expressive power, which probably matters only in complex
situations far beyond the limits of appropriate use of grep-like tools, is
only a minor benefit.

