[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Early Draft Review: XQuery for Java (JSR 225)


bytestreams in java
Ken North wrote:

>>What you say is quite impossible - maybe I am not clear enough:
>>the simple static analysis I am aiming at is made by the *Java
>>compiler*: correct syntax of the query, and possibly some type-checking.
>>This catches the "easily avoidable errors".
>>    
>>
>
>My point is you can use the prepare step to validate the query. It's not compile
>time, but it's pre-execution.
>
>  
>
...but doing this is completely left optional to the XQJ driver developers.
And it does not help the XQJ user much: the program has to be running, 
e.g. the development database used for unit testing has to be up and 
running...

>>Let us suppose you want to use such a tool: every abstract syntax tree
>>can be serialized to concrete syntax with no effort.
>>    
>>
>
>Suppose I want to [build | buy ] a query logger, performance monitor, trace tool
>or query designer that's programmed in C++ or Visual Basic. It can process or
>generate XQuery strings, but it's unlikely to "understand" encrypted Java
>bytestreams.
>
>  
>
Why, because Java uses UTF-16 ? I mean serialization to any format, 
including concrete syntax (==XQuery string) in whatever format.

Here's a calculator language (for terseness, with alebraic datatype)
abstract class Term { def toNiceString; /* this one is virtual */}
class Var(x:String) { def toNiceString = "$"+x }
class Plus( t1:Term, t2:Term ) = { def toNiceString= t1.toNiceString + " 
plus " + t2.toNiceString }

Serializing any instance t of Term happens by calling toNiceString.
We have just successfully serialized an abstract syntax tree.
We can look up the Visitor pattern from the Gang of Four book and 
reimplement this without putting "def toNiceString" in all classes.

Every reasonable compiler or language-tool (or also XQuery stuff from 
above) does pretty-printing in a way similar to this - a case 
distinction on the structure of the term(or query or program). In 
functional programming, you have a pattern match primitive built-in for 
this kind of task.

Strings can be generated as easy as a anything. You can go and interpret 
the stuff.

Most important, a user can build queries from typed building blocks at 
runtime and hand it over to the driver, without using raw strings.

I really don't understand how one could possibly want anything else as 
an interface for a domain-specific language.

cheers,
Burak

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.