- From: Volkmann, Mark <Mark.Volkmann@AGEDWARDS.com>
- Date: Thu, 22 Apr 2004 14:47:21 -0500
- To: 'Per Bothner' <per@bothner.com>
- Cc: "'www-ql@w3.org'" <www-ql@w3.org>
- Message-Id: <89539780CB9BD51182270002A5897DF60C0228C4@hqempn04.agedwards.com>
Okay, what if instead of trying to treat newline as a prolog statement
terminator we use either ; or } but not both. Wouldn't that work?
Perhaps in the case of } you'd have to count matching { characters and only
treat } as a statement terminator if it matched the only remaining unclosed
{.
> -----Original Message-----
> From: Per Bothner [mailto:per@bothner.com]
> Sent: Thursday, April 22, 2004 2:17 PM
> To: Volkmann, Mark
> Cc: 'www-ql@w3.org'
> Subject: Re: questionable syntax choices for XQuery
>
> Volkmann, Mark wrote:
>
> > The key part of that is "or newlines". Most Ruby
> programmers only use
> > semicolons in order to put more than one expression on the
> same line,
> > which isn't common.
>
> You gave Ruby as an example of a language that "doesn't
> require any kind
> of statement terminating character." A newline in Ruby is a
> statement
> terminating character, so your argument is void.
>
> Whether the statement terminating character is newline or semi-colon
> doesn't make much difference in terms of the grammar or parser. They
> may make a difference in terms of ease of use or error
> proneness. It is
> "natural" to put one statement on each line, so if the
> language enforces
> this (with an escape for lang lines) then a "visible"
> terminator would
> be reundant - and you don't really need to change the grammar.
>
> Using newlines to terminate statements is especially nice for
> interactive use, where it is even easier to forget to add
> semi-colons.
> Qexo has an interactive mode that accepts expressions and
> declarations.
> Semi-colons are optional after declarations. Qexo accepts
> a line as a
> complete command if the parsing state isn't nested - i.e. we're not
> inside parentheses, braces, element constructors, or an incomplete
> binary operator. This works pretty well.
>
> However, extending this to non-interactive mode isn't fully
> compatible.
> XQuery treats a (non-quoted) newline as equivalent to a
> space - i.e.
> as "whitespace". Treating a newline as a "statement
> terminator" instead
> may be tempting, but it's not a no-brainer.
>
> Note that XQuery is an expression language. Apart from the
> prolog, the
> rested of a program is one bi nested expression. XQuery
> doesn't really
> have "statements" in that sense, so a statement terminator isn't as
> useful. This would be different in a language with side-effects.
> --
> --Per Bothner
> per@bothner.com http://per.bothner.com/
>
-------------------------------------------------------------------------------------
A.G. Edwards & Sons' outgoing and incoming e-mails are electronically
archived and subject to review and/or disclosure to someone other
than the recipient.
-------------------------------------------------------------------------------------
Received on Thursday, 22 April 2004 15:55:54 UTC