I can just confirm Leo's observation. We (or anyone else) might need to detail this somewhere in our documentation.

Am 30.03.2012 02:09 schrieb "Leo Wörteler" <lw@basex.org>:
Hi,

Am 29.03.2012 18:53, schrieb Charles Duffy:
Using the REST interface, I'm currently able to do the following:

<rest:query xmlns:rest="http://basex.org/rest">
<rest:text>$foo</rest:text>
<rest:variable name="foo" value="bar"/>
</rest:query>

...and get back "bar" as a result. Note the lack of a "declare variable
$foo external" line.

I haven't read the spec to determine permissibility of this behavior,
but it does come in handy at times (particularly, for permitting
maximally terse one-liners). Is this something likely to go away in the
future?

I don't think this "feature" will disappear any time soon, because it's so widely used and doesn't cause any problems. It isn't backed up by the spec though. Every free variable $x in a query is treated as if it was declared as `declare variable $x external;`.

Hope that helps,
 cheers, Leo
_______________________________________________
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk