The X#/Xen (newly renamed c-omega) programming language has built in facilities to query data structures and databases.  I had the pleasure to work on that project, implementing all the query features.  The XML query features looked a bit like OPath from the recently reshuffled ObjectSpaces project, which is not too surprising since I thunk that language up too.  Still, I admit there were a lot of other smart guys in on the design of both.  The database query features looked pretty much like SQL embedded right into C#, though maybe leaning a bit toward the OQL style of SQL.  We had a lot of other alternatives to SQL'ish syntax.  In the end we decided to put in SQL and let the beta testers give us feedback.  

So the question I have to you all is this:  Do SQL like language construct (set-based query operators) belong in a mainstream programming language?  Is it sufficient to do this kind of work only through an API (as has been done for many years now)?  Do set-based restriction and projection operators dilute the language? 

To clarify, all operators added to the language SQL or XML query, also operated over in memory data structures.  So you could find values deep in graph-like datastructures using XPath style queries, matching names or types.  You could also use SQL select statements on collections of any data types you wanted to query.  This would all compile down to the actual code that would implement the queries.  In this way, a query operator became a short-hand to writing a mess of for-loops, etc.

What do you think?