develooper Front page | perl.perl6.language | Postings from November 2007

Re: xml and perl 6

Thread Previous | Thread Next
From:
Larry Wall
Date:
November 29, 2007 09:28
Subject:
Re: xml and perl 6
Message ID:
20071129172727.GA29384@wall.org
On Wed, Nov 28, 2007 at 07:52:31PM +0100, James Fuller wrote:
: On Nov 28, 2007 7:39 PM, Andy Armstrong <andy@hexten.net> wrote:
: > On 28 Nov 2007, at 18:28, James Fuller wrote:
: >
: > > A few things I could imagine; native XML data type (and whatever that
: > > means at this late stage) ....
: >
: > What might that mean at any stage?
: 
: from a syntactic point of view, here are  2 interesting examples of
: representing XML in a programming context
: 
: http://en.wikipedia.org/wiki/E4X
: 
: and
: 
: http://en.wikipedia.org/wiki/XQuery
: 
: there is lots to learn here.

There's lots to unlearn here too.  You give two examples of language
initiatives that attempt to mesh XML with other language.  Fine,
that sort of linguistic innovation has been going on since the dawn
of computers.  Now what if you want to use both of those languages
together?  How are they related to each other?  What's they're
pedigree, and whose rules are in operation where?  How can you even
consistently tell by inspection of the text which language is
intended at the top?

These are questions Perl 6 is addressing.  It will be *trivial* to
add syntax such as the above to Perl 6.  But unlike the initiatives
above, in Perl you always start out in Standard Perl 6 at the top
and explicitly derive your new language from that by declaration.
You can add a syntax like the above with a single "use" statement.
Unlike the unrelated languages you mention, these syntactic variants
are defined in terms of derivation from the standard Perl grammar,
which merely functions as a base class of parsing methods.

Let me put it this way.  Not even the Standard Perl 6 syntax is core
in the sense you're thinking of it.  There are basically *no* reserved
words in Perl 6.  What appear to be keywords are only convenient sets
of macros that fight it out under longest-token rules, and under those
rules there are no distinctions whatsoever between built-in constructs
and user-defined constructs.  When you derive a new language you are
merely adding to or subtracting from those sets of macros, and in the
limiting case you can subtract all of them and start over.  All is
fair if you predeclare.  Explicitly.

And all of those explicitly derived languages can be considered
"True Perl".  Even those cluttered up with XMLisms.

I'm not against use of XMLish syntax where appropriate, which
will generally be when you want to send data somewhere portably.
After all, I was the first to add an XML parser to Perl.  But XML
syntax makes a lousy programming language, and only a marginal data
description language.

And Perl 6 is not about getting trapped in the current fad, however
popular it might be.  In Perl 6 you have to declare explicitly that
you want to be trapped by the current fad.  :-)

Larry

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About