|
[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message] HashesJonathan Robie jonathan.robie at datadirect.comWed Sep 20 17:15:48 PDT 2006
Tim Finney wrote: > Sometimes I wish that XQuery had hashes: > > Clunky XQuery 1.0 way: > > if ($n = "a") then "aardvark" > else if ($n = "b") then "bandicoot" > ... > else if ($n = "z") then "zebra" > else () > > Declunked way: > > define variable $animals as xqy:hash { > "a" => "aardvark", "b" => "bandicoot", ... , "z" => "zebra" > } > > $animals[$n] > Seems reasonable - but why not just use a switch like in other languages? switch ($n) { case "a": "aardvark" case "b": "bandicoot" case "z": "zebra" default: "say, what?" } Obviously, not a candidate for XQuery 1.0, which is already a Candidate Recommendation. And which has great implementation experience, so I'm guessing we'll be a Proposed Recommendation soon. Jonathan -- Read my Blog: http://blogs.datadirect.com/jonathan_robie/ Learn XQuery: http://media.datadirect.com/download/docs/ddxquery/tutorial_query.html Learn XQJ (the JDBC for XQuery): http://www.datadirect.com/developer/xquery/topics/xqj_tutorial/ Get DataDirect XQuery: http://www.datadirect.com/products/xquery/
|
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
|






