When last we talked (
http://groups.google.com/group/clojure-dev/t/
1dfd473e6921ba0d?hl=en), we addressed the subtle question of where in
core.clj one crosses the line between providing core Clojure
functionality that ClojureCLR needs to reproduce exactly versus
providing access to the Java libs--presumably ClojureCLR does not need
to provide rewrites of all that. (As was stated.)
In that conversation, BigDecimal won. It is not clear there was any
consensus on resultset-seq.
But onward. re-dux = let's talk regular expressions.
The set of re-* functions in core.clj--re-pattern, re-matcher, re-
groups, re-seq, re-matches, re-find--are actually quite
java.util.regex-centric. There is sufficient mismatch compared to
the System.Text.RegularExpressions classes that I cannot expose them
directly and get these functions to work as advertised.
(For those who care, an example: the Java Matcher class starts out not
having made a match. The CLR Match class represents the first match
having already been made. If you do (re-groups (re-matcher #"\w+"
"abc")) in Clojure, it will throw an exception. In CLR, if re-matcher
returns a Match, the re-groups call will succeed. This one-off
problem messes up a number of these functions.)
Thus, literal exposure of the CLR regex classes will not map into
these functions as described.
So, should I:
(1) create my own shim classes to fake a certain amount (I hope not
all) of the functionality of the Pattern and Matcher classes from
java.util.regex, just enough to get the re* functions working,
(2) Ignore the existing re-* functions and implement a set of re-*
functions designed to work properly with Regex, Match, etc. in CLR?
(3) (1) + (2)
In other words, are the re-* functions Clojure-core or are they an
interface to some JVM functionality?
Two quick notes:
(1) the re-* functions are used exactly once in core.clj, in 'find-
doc. There are three occurrences in the new (GTIC) test framework.
(2) I have remarkably instances of this kind of problem to consider.
-- David