Jaa


Xen: SQL in the mainstream

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?

Comments

  • Anonymous
    June 07, 2004
    Sounds really cool to me. I agree that it does potentially dilute things (putting set based logic in procedural / object code), but that's happening from the other side now with the CLR in SQL Server.

    Sounds really powerful.
  • Anonymous
    June 08, 2004
    >>Do SQL like language construct (set-based query operators) belong in a mainstream programming language?

    Yes, and its called XQuery. Why not use that instead of inventing YAMSIoaOSL? (grin).

    >>Is it sufficient to do this kind of work only through an API (as has been done for many years now)?

    Eventually, its all just an API anyway. That said, I'd like to see some exaples.

    >>Do set-based restriction and projection operators dilute the language?

    They dilute less than they enhance. I look at Xen as being like a claw hammer -- having both ways of solving problems with one tool will be helpful. That said, only time will tell if you can really make this as generalized as claw hammer has become.

    >>What do you think?
    I can't freak'n wait. I want this stuff NOW. :)

    By the way, how on earth do we get into the beta for Xen?

    Thanks!
    kt
  • Anonymous
    June 08, 2004
    Very cool idea! This would be awesome because SQL/OQL and set based operations give you so much querying power in a relatively terse format. Yes, you can write the same kind of queries with lots of for loops, but it is so much easier to see what is going on if it is all together in one query instead of in 10 for loops which reside in 4 different methods that each call 2 or three helper functions, etc...
  • Anonymous
    June 08, 2004
    Take Outs for 8 June 2004
  • Anonymous
    June 08, 2004
    The comment has been removed
  • Anonymous
    June 12, 2004
    >> Do SQL like language construct (set-based query operators) belong in a mainstream programming language?

    YES! Just please don't make it as clunky as SQL. SQL was awesome when it was created, but it is showing its age. Email me if you'd like me to elaborate.
  • Anonymous
    August 06, 2004
    You know, if you include really good sql-like querying in Xen, it would be a great stored procedure language...