Regular Expressions in 100 lines of Scala
rcoh.svbtle.com
rcoh.svbtle.com
Part 1: http://rcoh.svbtle.com/no-magic-regular-expressions
Part 2: http://rcoh.svbtle.com/regular-expressions-part-2
Part 3: http://rcoh.svbtle.com/no-magic-regular-expressions-part-3
It's really well done!
[1]: http://www.cs.princeton.edu/courses/archive/spr09/cos333/bea...
reg exp engine in 14 lines of python https://news.ycombinator.com/item?id=3202313
For example, you probably were never able to take advantage of type classes, (G)ADTs, value classes, recursive types, exhaustive pattern matching, etc., etc. back in the day.
Would be nice to have an OO expert/advocate on the Scala side of the fence to provide a counter point to the FP wave.
It really all depends on what criterion you use.
As someone who's had to push for both, many organizations find introducing Scala easier than doing a JVM upgrade (since the latter requires work on the ops side). Last time I looked, e.g. the New Relic agent would crash if you tried to run it under Java 8 - whereas it will profile your Play transactions just fine.
Popularity is a lagging indicator. The tooling is there already, quite frankly - we see first-class support for Scala in new efforts like Takipi. Jobs are what you make them - more than once I've taken a Java job and turned it into a Scala job. I honestly believe it's the best general-purpose language going right now (which is why I use it, and why I have a job doing it full-time).
While the code is concise, this is more a case of "it implements A and B of an X" than "it implements an X, apart from A and B".
Still, all three parts of the series are a good read, and definitely helpful for learning about parsing and about Scala.
The advantage of mathematical regular expressions is that they terminate in O(n) time based on the length of the input string. The disadvantage is that they lack features like capture groups and look ahead/behind. The important point is that engines like those of Perl or Java are not based on regular expressions in a mathematical sense. This is true of any Regex engine that stores state or backtracks.