|
[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message] How much laziness is permitted?John Snelson john.snelson at oracle.comWed Mar 11 17:24:42 PST 2009
Michael Kay wrote: >> Pavel Minaev wrote: >>> (* module 1 *) >>> declare function m1:gen() { >>> for $x in 1 to 10000 return if ($x lt 10000) then $x else error() >>> } >>> >>> (* module 2 *) >>> declare function m2:trygen() { >>> try { m1:gen() } catch * { () } >>> }; >>> >> John Snelson: As it turns out, try/catch is actually a blocking operation >> on lazy evaluation. > > I think that's certainly true of a naive implementation (and it's largely > true of Saxon's current implementation). However, I think some optimization > rewrites are still legitimate: for example, given an expression such as > > (try{ E } catch * {F})[1] > > I think an implementation can legitimately rewrite this as > > try{ E[1] } catch * {F[1]} > > exploiting the knowledge that E[1] cannot throw an error unless E throws an > error. Yes, that's true. John -- John Snelson, Oracle Corporation http://snelson.org.uk/john Berkeley DB XML: http://oracle.com/database/berkeley-db/xml XQilla: http://xqilla.sourceforge.net
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






