<i18n dev> Java and regex-based languages
tchrist at perl.com
Thu Jan 20 12:56:42 PST 2011
> I would also like to point out that Java is NOT a RegEx based
> language/platform, RegEx is not part of the Java language (I
> means the language specification), it is one of the utility
> packages in Java platform's core libraries.
I *do* understand what sorts of compromises are involved when one
elects to implement regular expression through an add-on library
instead of being part of the basic language itself. One can see
these differences in the different approaches taken by Java versus
those taken by Groovy, a popular JVM language.
Because its compiler recognizes regexes as first class citizens (so to
speak) Groovy indeed addresses many of the merely syntactic issues. I
won't dwell on those at all, both because they're all surface issues, even
superficial ones, and also because I understand what is and is not possible
in a library.
For the record, Scala, another JVM language (but more of a static one,
where Groovy is dynamic) also provides ease-of-use features to its regexes
that are similar to those provided by Groovy. It uses the Python approach,
Even Clojure, the JVM language with a Lisp or Scheme look-and-feel, offers
a bit above what Java itself does. It's doesn't go as far as Scala let
alone Groovy, but it does do a little bit.
No matter how much syntactic sugar for regexes is provided by compilers
of JVM languages like Groovy, Scalar, or Clojure, because the underlying
code compiles down to calls to the standard Java Pattern and/or Matcher
classes, one is still constrained to whatever level of functionality
those core classes themselves provide.
I'm sure I don't need to tell you of all people about all the
exciting growth in these other JVM-based languages that we've seen
in the last few years. By fortifying the underlying Java core
classes that everybody else relies upon, even more people are
affected than those using Java directly.
More information about the i18n-dev