I'm a language slut as much as anyone, but I feel like this territory has been covered. I think initially of Cu (.Net platform), a language that has XML, relational, and OO structures all as first-class citizens.<br><br>
I like that XQuery has tight focus -- I think of it as a functional DSL for processing XML, and that's a great thing. (Adding functions as first-class types would really kick ass, though!) But adding "methods" to XSD types? Eh (shrug).<br>
<br>Brian Maso<br><br><div class="gmail_quote">On Tue, Jan 20, 2009 at 3:38 PM, Ghislain Fourny <span dir="ltr"><<a href="mailto:gfourny@inf.ethz.ch">gfourny@inf.ethz.ch</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div style=""><div><span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">Hello, </span></span></span></span></div>
<div><br></div><div><div>I totally agree with you that this is a rather minor step forward, but as a programmer, I really value the possibility to have a way to structure a program in modules and classes if the data is highly structured: it makes the code easier to understand and it makes it easier to build big applications. This is one step towards encapsulation, without removing the ability of XQuery to deal with unstructured data. But this might be simply a matter of taste and of programming style, so this is somehow subjective.</div>
<div><br></div><div>Regarding static typing and Saxon: we do not use Saxon for the static typing which determines which method is executed. Instead, we perform a very basic and well-defined static typing on complex types based on explicit type declarations and on the imported schema. Saxon SA is only used to execute the compiled output, in which the method has already been bound. So if you make changes to your optimisations, this will not affect the result of the queries.</div>
<div><br></div><div>Kind regards,</div><div>Ghislain Fourny</div><font color="#888888"><div><br></div><div></div></font></div><div><div></div><div class="Wj3C7c"><div><blockquote type="cite"> <div style=""> <div dir="ltr" align="left">
<font size="2" color="#0000ff" face="Arial"></font> </div> <blockquote dir="ltr" style="border-left: 2px solid rgb(0, 0, 255); padding-left: 5px; margin-left: 5px; margin-right: 0px;"> <div> <div>In my research group, we are actually working on a project about object orientation in XQuery, called Unity. We did not go into dynamic binding or polymorphism, but basically, we simply tried to introduce code in the schema to allow constructs like, following your idea:</div>
</div> <div><br></div> <div>$triangle/rotate()</div> <div><br></div> <div>where the context item is passed as a hidden parameter to the method rotate. The method rotate is defined in the schema for the static type of $triangle.<span><font size="2" color="#0000ff" face="Arial"> </font></span></div>
<div><span></span> </div> <div><span><font size="2" color="#0000ff" face="Arial">I don't think static polymorphism (overloading based on the static type of the arguments - here the implicit first argument) - is a particularly useful step forwards. It gives a minor syntactic convenience for the kind of highly structured data where static typing works, but the real need is for something more dynamic.</font></span></div>
<span><font size="2" color="#0000ff" face="Arial"></font></span></blockquote> <blockquote dir="ltr" style="border-left: 2px solid rgb(0, 0, 255); padding-left: 5px; margin-left: 5px; margin-right: 0px;"><span></span> <div>
<span></span><font face="Arial"><font color="#0000ff"><font size="2">I<span>'m all in favour of allowing a function to declare that it takes the context item as an implicit parameter, but that's just a bit of syntactic sugar. </span></font></font></font><br>
</div> <div>We have implemented a cross-compiler which compiles Unity code to XQuery+XML Schema, and could test the output successfully with Saxon SA on several examples. We did not encounter any major issues during the implementation. One issue could be a name collision between a method and a function, which can be solved by looking at methods for the static type of the context item first, and then at functions.</div>
<div><br><span><font size="2" color="#0000ff" face="Arial">I think that if you are despatching different methods based on the results of static type inferencing, then the static type rules need to be visible to, and comprehensible to, the users of the language. That isn't the case with Saxon's current static typing, which is designed for optimization and diagnostics only - it shouldn't affect the result of the query, so it's done as intelligently as Saxon considers appropriate. I would be very concerned about "freezing" the static typing rules in such a way that a change to make it more clever could affect the results of user queries.</font></span></div>
<div><span><font size="2" color="#0000ff" face="Arial"></font></span> </div> <div><span><font size="2" color="#0000ff" face="Arial">Michael Kay</font></span></div> <div><span><font size="2" color="#0000ff" face="Arial"><a href="http://www.saxonica.com/" target="_blank">http://www.saxonica.com/</a></font></span></div>
</blockquote></div></blockquote></div><br></div></div></div><br>_______________________________________________<br>
<a href="mailto:talk@x-query.com">talk@x-query.com</a><br>
<a href="http://x-query.com/mailman/listinfo/talk" target="_blank">http://x-query.com/mailman/listinfo/talk</a><br></blockquote></div><br>