<div dir="ltr">I think that was distinguishes LINQ is not that it was the first such experiment, but that it was the first one that happened in a mainstream non-declarative language (as opposed to a fork of one) <i>and </i>was widely adopted by the community of that language.<div><br></div><div>As far as what's "better", I think that there are really two different questions here: what's "better" in The Right Way sense, and what's "better" in a "how do you get people to use this" sense. For the latter, there's no doubt in my mind that the way there is to get existing mainstream languages (which are all imperative at heart) to adopt more declarative goodness, including comprehensions/queries, as a subset - it's a much gentler transition for existing users of those languages, and more importantly, it's like a new instrument magically appearing in a toolbox that they already use daily - at some point they're bound to pick it up and use it even just out of sheer curiosity. It's much harder to get someone interested in a completely new language in comparison.</div><div><br></div><div>I'm curious as to what exactly you believe to be features that are necessary to semi-structured data that are unique to XQuery. I've looked at the posts that you've linked to, and e.g. conditionals/typeswitches, functions and recursive functions, and try/catch, are there in pretty much any imperative language with sequence comprehensions, and can usually be combined more or less seamlessly (though if I had to bring up a particularly good example of all of these, it would be F# computation expressions, which are also nicely generalized and extensible - see <a href="https://msdn.microsoft.com/en-us/library/dd233209.aspx">https://msdn.microsoft.com/en-us/library/dd233209.aspx</a> and <a href="https://msdn.microsoft.com/en-us/library/dd233182.aspx">https://msdn.microsoft.com/en-us/library/dd233182.aspx</a>). Implicit type conversions are the only point I can think of that's truly unique here, but I think that to what degree that is appropriate is highly subjective - it's just as easy to get messed-up output with no clear indication of what the problem was due to an unfortunate conversion producing garbage somewhere in the middle of a particularly complicated query. It all depends on the data.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 23, 2015 at 3:35 PM, daniela florescu <span dir="ltr"><<a href="mailto:dflorescu@me.com" target="_blank">dflorescu@me.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>Pavel,</div><div><br></div><div>NOW we are talking about interesting research !!!! :-)))) </div><div><br></div><div>Sequence comprehension. Here we go….:-)</div><div><br></div><div>Yes, sequence comprehension  (it’s called monoid comprehension in</div><div>theoretical computer science….)   IS the one of the most important things</div><div> for a high level/declarative language.</div><div><br></div><div>However, several important remarks:</div><div><br></div><div>============</div><div><br></div><div>1. Linq  is NOT a new idea. My PhD thesis was (partially) about adding SELECT-FROM-WHERE</div><div>as an expression to C++. I did it as a pre-processor at that time — remember, it was 1994.</div><div>Others did it too, decades before me !!!!  Remember Pascal-R !??? <a href="http://archive.nyu.edu/fda/handle/2451/14595" target="_blank">http://archive.nyu.edu/fda/handle/2451/14595</a> </div><div>(probably not, because you are too young..)</div><div><br></div><div>2. in 2015 XQuery has FROM FAR (!!!!!!!!!!)  the most advanced,  expressive-wise, AND</div><div> the cleanest semantic-wise version of sequence comprehension.</div><div><br></div><div>Every other language should use THAT instead of half-baking Yet-Another-Sequence-Comprehension.</div><div><br></div><div>The FLWOR of XQuery is semantically very clean, has nothing to do with XML, is compositional and elegant,</div><div>and, moreover, optimizable.</div><div><br></div><div><br></div><div>3. The discussion : should we add sequence comprehension to an exiting imperative language vs. </div><div>adding scripting extensions to XQuery/high level functional language with sequence comprehension</div><div> is again old as the times.</div><div><br></div><div>see for example:</div><div><a href="http://dl.acm.org/citation.cfm?id=1142597&dl=ACM&coll=DL&CFID=522088426&CFTOKEN=80093091" target="_blank">http://dl.acm.org/citation.cfm?id=1142597&dl=ACM&coll=DL&CFID=522088426&CFTOKEN=80093091</a></div><div>( Donald Kossmann and I  had a detailed  tutorial at Sigmod 2006, and the slides were REALLY funny, if I remember correctly) </div><div><br></div><div>This was in 2006. (when you read the paper just do a global replace “XML” with “semi-structured data”)</div><div><br></div><div>Now, in 2015, I think BOTH alternatives are good, and viable.</div><div><br></div><div>For example, adding a FLWOR expression to Javascript is a worthwile thing to do, and I am implementing this as we speak.</div><div><br></div><div>Another example: what do you think that Oracle Fusion was (multi-billion failure..)!? Just a rewrite of Oracle application, where the code instead of being written</div><div>in PL-SQL was written in Java with SQL. </div><div><br></div><div>Same story/question again. </div><div><br></div><div>4.  Sequence comprehension is necessary for processing data in general, structured or non-structured.</div><div><br></div><div>However, for processing ****SEMI-STRUCTURED DATA**** you need EXTRA other features, non-existing in </div><div>ANY other language except XQuery and XSLT.</div><div><br></div><div>I tried to put a list of features needed for semi-structured data in a previous email to this list, ….</div><div><a href="http://x-query.com/pipermail/talk/2015-May/004718.html" target="_blank">http://x-query.com/pipermail/talk/2015-May/004718.html</a></div><div><a href="http://x-query.com/pipermail/talk/2015-May/004719.html" target="_blank">http://x-query.com/pipermail/talk/2015-May/004719.html</a></div><div><br></div><div>…..but of course I did it fast, and forgot some of the necessary features.</div><div>In particular, I forgot the ability to do metadata search (aka path expressions where you don’t know the data structure).</div><div><br></div><div>===========</div><div><br></div><div><br></div><div><br></div><div>So, yep. Lots of Computer Science history.</div><div><br></div><div><br></div><div>This is why it is DAMN SAD to see those barbarians starting to query JSON in 2015  like it’s 1995  again …….</div><div><br></div><div><br></div><div><br></div><div>Best</div><div>Dana</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><br><div><blockquote type="cite"><div>On Jun 23, 2015, at 3:07 PM, Pavel Minaev <<a href="mailto:int19h@gmail.com" target="_blank">int19h@gmail.com</a>> wrote:</div><br><div><div dir="ltr">I don't mind at all.<br><br>And of course XQuery (well, the parts that are not tied to XDM) is orthogonal to XML. The way I see it, FLWOR syntax (as well as LINQ etc) is basically just a very fancy sequence comprehension, and obviously sequences and trees aren't XML-specific at all. <div><br></div><div><div>FWIW, back when I first saw XQuery (which was after LINQ for me), I remember being somewhat surprised at the choice of "return" especially for a keyword. It's not that it was unclear what it did, and the mapping to the more familiar syntax was obvious. It's just that it implies some transfer of control traditionally, which is obviously not the case here. "yield", as used in Scala and F#, made a lot more sense.<br></div><div><br></div><div>I don't mind "for" as much, on the other hand, seeing how it's pretty commonly used for sequence comprehensions elsewhere (Python, Scala, F# ...). I think the main reason why LINQ used "from" instead is to induce a sense of familiarity for those coming from SQL background, which was 99% of its target audience.</div></div><div><br></div><div>Side note: I don't think that standalone query languages make much sense now that integrated syntax for sequence comprehensions has become mainstream for high-level languages. It's just too much effort to do explicit interop from, say, Java, C# and JS, to XQuery or JSONiq, and it introduces a new syntax for concepts which are already represented in the host language, with said syntax being constrained to one narrow domain (XML/JSON). I think that the way forward is going to be more like LINQ - taking (hopefully!) the lessons learned from dedicated query languages and seamlessly integrating them into the language such that they can work on its native data model, and mapping XML, JSON etc to that model as transparently as possible.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 23, 2015 at 2:56 PM, daniela florescu <span dir="ltr"><<a href="mailto:dflorescu@me.com" target="_blank">dflorescu@me.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Pavel, I hope you don’t mind that I forward your personal  email to the main list.<div><br></div><div><div>Thanks for the links. </div><div><br></div><div>Yes, I am of course aware of the history of it, but I don’t think everyone else is.</div><div><br></div><div>(I even gave feedback to Erik Meijer before he submitted this proposal to Bill Gates…. and I lost</div><div>a beer with him because we bet who among the two of us knows XML Schema better — and he did :-).</div><div><br></div><div>This reinforces the ideas that:</div><div><br></div><div>1. the principles of XQuery are orthogonal to XML itself and</div><div><br></div><div>2. spelling FROM and SELECT seems to matter to people A LOT.</div><div><br></div><div>Best regards</div><div>Dana</div><div><div><div><br></div><div><br><div><blockquote type="cite"><div>On Jun 23, 2015, at 2:44 PM, Pavel Minaev <<a href="mailto:int19h@gmail.com" target="_blank">int19h@gmail.com</a>> wrote:</div><br><div><div dir="ltr">FWIW, "this language" is actually LINQ:<div><br></div><div><a href="https://msdn.microsoft.com/en-us/library/bb397896(v=vs.140).aspx" target="_blank">https://msdn.microsoft.com/en-us/library/bb397896(v=vs.140).aspx</a><br></div><div><br></div><div>Which, ironically, came out of an earlier Microsoft project called Cω (and specifically, the subset of it called X#), which was basically an attempt to graft a subset of XQuery onto C#:</div><div><br></div><div><a href="https://msdn.microsoft.com/en-us/library/ms974195.aspx" target="_blank">https://msdn.microsoft.com/en-us/library/ms974195.aspx</a><br></div><div><br></div><div>It became LINQ after it dropped ties to XDM and was generalized to operate on arbitrary CLI object graphs instead.<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 23, 2015 at 2:31 PM, daniela florescu <span dir="ltr"><<a href="mailto:dflorescu@me.com" target="_blank">dflorescu@me.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">One thing that did strike me is the link cited in one of the comments about this article:<div><br></div><div><span style="color:rgb(51,51,51);font-family:Helvetica,Arial,sans-serif;font-size:13px;line-height:17px;white-space:pre-line;background-color:rgb(255,255,255)"><a href="http://queue.acm.org/detail.cfm?id=1961297" target="_blank">http://queue.acm.org/detail.cfm?id=1961297</a></span></div><div><font color="#333333" face="Helvetica, Arial, sans-serif" size="2"><span style="line-height:17px;white-space:pre-line;background-color:rgb(255,255,255)"><br></span></font></div><div><font color="#333333" face="Helvetica, Arial, sans-serif" size="2"><span style="line-height:17px;white-space:pre-line;background-color:rgb(255,255,255)">Just look at the examples.</span></font></div><div><font color="#333333" face="Helvetica, Arial, sans-serif" size="2"><span style="line-height:17px;white-space:pre-line;background-color:rgb(255,255,255)"><br></span></font></div><div><font color="#333333" face="Helvetica, Arial, sans-serif" size="2"><span style="line-height:17px;white-space:pre-line;background-color:rgb(255,255,255)">Does everyone see what I see !? :-)</span></font></div><div><font color="#333333" face="Helvetica, Arial, sans-serif" size="2"><span style="line-height:17px;white-space:pre-line;background-color:rgb(255,255,255)"><br></span></font></div><div><font color="#333333" face="Helvetica, Arial, sans-serif" size="2"><span style="line-height:17px;white-space:pre-line;background-color:rgb(255,255,255)">Those are just FLWOR expressions, with FOR spelled as FROM and RETURN spelled</span></font></div><div><font color="#333333" face="Helvetica, Arial, sans-serif" size="2"><span style="line-height:17px;white-space:pre-line;background-color:rgb(255,255,255)">as SELECT.</span></font></div><div><font color="#333333" face="Helvetica, Arial, sans-serif" size="2"><span style="line-height:17px;white-space:pre-line;background-color:rgb(255,255,255)"><br></span></font></div><div><font color="#333333" face="Helvetica, Arial, sans-serif" size="2"><span style="background-color:rgb(255,255,255)"><span style="line-height:17px;white-space:pre-line">Can we PLEASE add those as synonyms in the XQuery grammar before you close XQuery 3.1  !?</span></span></font></div><div><font color="#333333" face="Helvetica, Arial, sans-serif" size="2"><span style="background-color:rgb(255,255,255)"><span style="line-height:17px;white-space:pre-line"><br></span></span></font></div><div><font color="#333333" face="Helvetica, Arial, sans-serif" size="2"><span style="background-color:rgb(255,255,255)"><span style="line-height:17px;white-space:pre-line">Otherwise we’ll hear for another 100 years that XQuery has nothing to do with SQL while THIS language</span></span></font></div><div><font color="#333333" face="Helvetica, Arial, sans-serif" size="2"><span style="background-color:rgb(255,255,255)"><span style="line-height:17px;white-space:pre-line">describe in this paper DOES. (sic!)</span></span></font></div><div><font color="#333333" face="Helvetica, Arial, sans-serif" size="2"><span style="background-color:rgb(255,255,255)"><span style="line-height:17px;white-space:pre-line"><br></span></span></font></div><div><font color="#333333" face="Helvetica, Arial, sans-serif" size="2"><span style="background-color:rgb(255,255,255)"><span style="line-height:17px;white-space:pre-line">It’s dumb, but that’s how it is.</span></span></font></div><div><br></div><div><div><font color="#333333" face="Helvetica, Arial, sans-serif" size="2"><span style="background-color:rgb(255,255,255)"><span style="line-height:17px;white-space:pre-line">Pretty please !???</span></span></font></div></div><div><font color="#333333" face="Helvetica, Arial, sans-serif" size="2"><span style="background-color:rgb(255,255,255)"><span style="line-height:17px;white-space:pre-line"><br></span></span></font></div><div><font color="#333333" face="Helvetica, Arial, sans-serif" size="2"><span style="background-color:rgb(255,255,255)"><span style="line-height:17px;white-space:pre-line">Thanks</span></span></font></div><div><font color="#333333" face="Helvetica, Arial, sans-serif" size="2"><span style="background-color:rgb(255,255,255)"><span style="line-height:17px;white-space:pre-line">Dana</span></span></font></div><div><font color="#333333" face="Helvetica, Arial, sans-serif" size="2"><span style="background-color:rgb(255,255,255)"><span style="line-height:17px;white-space:pre-line"><br></span></span></font></div><div><font color="#333333" face="Helvetica, Arial, sans-serif" size="2"><span style="background-color:rgb(255,255,255)"><span style="line-height:17px;white-space:pre-line"><br></span></span></font></div><div><font color="#333333" face="Helvetica, Arial, sans-serif" size="2"><span style="line-height:17px;white-space:pre-line;background-color:rgb(255,255,255)"><br></span></font><div><blockquote type="cite"><div>On Jun 23, 2015, at 11:04 AM, daniela florescu <<a href="mailto:dflorescu@me.com" target="_blank">dflorescu@me.com</a>> wrote:</div><br><div><div style="word-wrap:break-word">Ihe,<br><div><br></div><div>you asked why XQuery is not more popular.</div><div><br></div><div>Here is another striking answer to your question: NOBODY KNOWS IT EXISTS.</div><div><br></div><div>Just look at this example.<div><br></div><div><a href="https://www.linkedin.com/pulse/sql-vs-discrepancy-somil-asthana?trk=hp-feed-article-title-like" target="_blank">https://www.linkedin.com/pulse/sql-vs-discrepancy-somil-asthana?trk=hp-feed-article-title-like</a></div><div><br></div><div>I quote: "<span style="color:rgb(77,79,81);font-family:Helvetica,Arial,sans-serif;font-size:16px;line-height:24px;background-color:rgb(255,255,255)">Indisputably, there may be people who are working on Non Relational</span></div><div><span style="color:rgb(77,79,81);font-family:Helvetica,Arial,sans-serif;font-size:16px;line-height:24px;background-color:rgb(255,255,255)"> Algebra and Non Tuple Relational Calculus, its just that we do not know them.</span><font color="#4d4f51" face="Helvetica, Arial, sans-serif" size="3"><span style="line-height:24px">”</span></font></div><div><span style="color:rgb(77,79,81);font-family:Helvetica,Arial,sans-serif;font-size:16px;line-height:24px;background-color:rgb(255,255,255)"><br></span></div><div><span style="background-color:rgb(255,255,255)"><font color="#4d4f51" face="Helvetica, Arial, sans-serif" size="3"><span style="line-height:24px">[[[Can someone just answer this guy, so I don’t have to insult him/her !?</span></font></span></div><div><span style="background-color:rgb(255,255,255)"><font color="#4d4f51" face="Helvetica, Arial, sans-serif" size="3"><span style="line-height:24px">Because I feel a really strong urge….I’ll try to breathe and do some meditation….]]]</span></font></span></div><div><span style="background-color:rgb(255,255,255)"><font color="#4d4f51" face="Helvetica, Arial, sans-serif" size="3"><span style="line-height:24px"><br></span></font></span></div><div><span style="background-color:rgb(255,255,255)"><font color="#4d4f51" face="Helvetica, Arial, sans-serif" size="3"><span style="line-height:24px">In fact, I know that this is not his/her limitation.</span></font></span></div><div><span style="background-color:rgb(255,255,255)"><font color="#4d4f51" face="Helvetica, Arial, sans-serif" size="3"><span style="line-height:24px"><br></span></font></span></div><div><span style="background-color:rgb(255,255,255)"><font color="#4d4f51" face="Helvetica, Arial, sans-serif" size="3"><span style="line-height:24px">It’s our OWN failure to explain to the world what XQuery is, what it does, and what is good at.</span></font></span></div><div><span style="background-color:rgb(255,255,255)"><font color="#4d4f51" face="Helvetica, Arial, sans-serif" size="3"><span style="line-height:24px"><br></span></font></span></div><div>Best regards</div></div><div>Dana</div><div><br></div><div><br></div><div>P.S. And after that, please DON’T ask me why I am SO pissed off at MarkLogic who pretend they never ate the garlic, not does</div><div>their mouth smell of garlic…..</div><div><br></div><div>They MADE all their money out of the power of XQuery  (expressiveness, productivity, etc), yet they pretend they’ve never heard of it….</div><div><br></div><div>That’s something that REALLY gets me angry.</div><div><br></div><div>And this will come back to bait them on the business side very badly too. </div><div><br></div><div>Oracle would have NEVER done the same thing about SQL…..just saying.</div><div><br></div><div><br></div><div><br></div><div><br></div></div></div></blockquote></div><br></div></div><br>_______________________________________________<br>
<a href="mailto:talk@x-query.com" target="_blank">talk@x-query.com</a><br>
<a href="http://x-query.com/mailman/listinfo/talk" rel="noreferrer" target="_blank">http://x-query.com/mailman/listinfo/talk</a><br></blockquote></div><br></div>
</div></blockquote></div><br></div></div></div></div></div></blockquote></div><br></div>
</div></blockquote></div><br></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" rel="noreferrer" target="_blank">http://x-query.com/mailman/listinfo/talk</a><br></blockquote></div><br></div>