[
Lists Home |
Date Index |
Thread Index
]
Quoting Burak Emir <Burak.Emir@epfl.ch>:
> >
> >
> I certainly do not know any schema language that deals with "segmented"
> regular expressions.
>
> However, in research languages, regular pattern matching is getting
> quite popular. In Scala for instance, your SSN could be decomposed like
> this
>
> def decomp(ssn:Seq[Char]):Pair[Seq[Char],Seq[Char]] = ssn match {
> case (part1 @ DD-AA)(part2 @ BDD-DDDD) => Pair(part1, part2)
> case _ => error("invalid ssn")
> }
>
Thanks for your reply, that scala looks pretty interesting. Maybe I should look
at that language again (checked it out once when it was on lambda)
> I once had the idea of adding this feature of pattern matching to a (yet
> another) type system for objects and XML(turning sequences of nodes in
> something like a record). Glad there seems to be use for it.
Yeah, after posting I got the idea to implement it as an extension to
schematron, processor specific, using the skeleton1-5.xsl
basically one would have some data types declared at the top of the schematron
schema:
<sch:dtypes>
<sch:type name="Date" using="jscript:Date"/>
<sch:type name="USDate" using="dtype:Date">
<test>....</test>
</sch:type>
</sch:dtypes>
and then under specific rules:
<sch:isDtype type="USDate"/>
obviously I haven't got to the dtype: functionality yet (not exactly sure how I
want the syntax to work anyway), but checking against anything that inherits
from jscript: just means calling a function that returns a boolean dependent on
how some typechecking and or loading into a new instance of the object works
out.
Gets me wondering also if Dmitri Novatchev's fxsl might not be put to good work
to extend schematron with data typing.
|