[xquery-talk] XQuery file naming conventions (xq, xqy, xql, xqm, xquery, etc.)

David Lee dlee at calldei.com
Mon Jan 7 13:43:19 PST 2013


My opinion.
First, just like C and Java etc ... I dont see a need to seperate Libraries and Modules and Mains with extensions.
The extension (should, IMHO) apply to the source language not to the use its applied.
 
A single extension should do, and its main job is to load the right editor (for GUI systems ),and for non-gui systems 
is useful for simply telling apart languages like .xslt and .xquery
Hey what do people use for .xslt ?  .xsl ? .xs ?  How about just .x and let the first line dictate !!!!


Whenever I am by myself I use .xquery ... it just makes sense !
When I joined MarkLogic I adopted their convention for any code I write to be shipped with ML and use .xqy
But for anything personal I still use .xquery

I dont see the need for any more but hey, like standards the fun is that there are so many !



----------------------------------------
David A. Lee
dlee at calldei.com
http://www.xmlsh.org

-----Original Message-----
From: talk-bounces at x-query.com [mailto:talk-bounces at x-query.com] On Behalf Of Joe Wicentowski
Sent: Monday, January 07, 2013 4:33 PM
To: XQuery Talk
Subject: [xquery-talk] XQuery file naming conventions (xq, xqy, xql, xqm, xquery, etc.)

Hi all,

There is quite a profusion of file extensions for XQuery: .xq, .xqy,
.xql, .xqm, and .xquery.  Perhaps this profusion has happened the spec
doesn't say anything about the file extensions.  This has opened up
the choice to each implementation and each community/project.  I'd be
interested to know which communities use which file naming
conventions, and if there is any consensus?  What do you use, and why?

My experience: When I first started learning XQuery I used .xq for
everything -- I guess because it's short.  oXygen uses .xquery as its
default file extension for XQuery files but recognizes all of the
above as XQuery files.  The MarkLogic community seems to use .xqy.
When I started to write library modules I started to use .xqm, with
the 'm' indicating module.  I saw yet others in the eXist-db community
using .xql, though it allows all of the above.  Github doesn't
currently recognize .xql or .xqm as XQuery [1].  Diversity is fine,
but the downside is that newcomers are certainly confused, and anytime
we share code there is no reliable way to know whether a file is a
library or main module without opening it up.

The spec does make a distinction that seems to apply to XQuery files.
It states that there are two kinds of modules: *library* modules and
*main* modules.  The distinction is that library modules contain only
functions, whereas main modules contain a single main routine (though
can also contain function declarations).  (See these two terms defined
in the spec at http://www.w3.org/TR/xquery/#dt-library-module and
http://www.w3.org/TR/xquery/#dt-main-module.)

It seems to me that any good XQuery file naming convention should
reflect this distinction between *library* and *main* modules.

After thinking about this, I think .xql and .xqm make good candidates
for a file naming convention, since they mnemonically reflect the
distinction between library (L) and main (M).  Where does that leave
.xq, .xqy, or .xquery?  I guess they're acceptable alternatives to .xq
for main modules, but in my own new projects I think I'm going to go
with .xql and .xqm.

What practices do you use?  What do you think?  Does your
implementation/community document your practice?

Joe

[1] https://github.com/github/linguist/blob/master/lib/linguist/languages.yml.
 I've submitted a pull request to add .xql and .xqm,
https://github.com/github/linguist/pull/338.
_______________________________________________
talk at x-query.com
http://x-query.com/mailman/listinfo/talk





More information about the talk mailing list