XML DTD for Python source?

gvwilson at nevex.com gvwilson at nevex.com
Fri Mar 3 19:36:46 CET 2000


> > Greg Wilson:
> > I'm interested in exploring what would happen if I could
> > do with programs what I do with hypertext:
> > 
> > - apply a DTD to switch between Scheme-style parenthesizing, Python-style
> >   indentation, or C-style bracing
> >
> > - embed arbitrary information (images, optimization hints for the compiler,
> > etc.) in
> 
> On Thu, 2 Mar 2000, Paul Prescod wrote:
> Sounds like structured comments to me.

Structured comments sound to me like an after-the-fact rationalization of
an out-of-date infatuation with flat ASCII... :-)

> > a way that third-party browsers and processors can handle
> > (specially-formatted comments are *not* the answer)
> 
> Third party browsers and processors can handle a Python AST if you
> give them a plug-in.

I thought the whole point of having a standard (like XML) was to free you
from plug-ins...

> Anyhow, if you are really interested in third-party browsers, the best
> thing would be to convert into colorized *HTML*.

What is your metric for claiming that this is "best"?

> Dozens of people have tried and given up on programming in XML.

If you mean "using XML syntax directly as a programming language", then
yes, it's a bad idea.  If you mean "using XML under the hood to store
programs", then I'd be grateful for references.

> Let's start with the problem of verbosity. Your if statement above is
> not even close to what a semantic "Python DTD" would require. It would
> be more like:
> 
> <if><less-than><variable name="i"/><integer val="10"/></less-than></if>
> 
> That's pretty trick to read. So what we really need is for the editor
> to compress it to something more readable -- like the original
> notation...

...or curly braces, or Scheme-style parentheses, or maybe pretty little
icons decorating the control structure for my 8-year-old nephew, or...

> Seriously, I get paid to customize XMetaL and its ilk for document
> types. It's hard enough making them usable for the document-world they
> were designed for. Making them good programming environments would be
> more work than adding multimedia hooks to Emacs pymode (IMHO).

Which is easier to teach to 8-year-olds?

Thanks,
Greg





More information about the Python-list mailing list