emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Refactoring xml.el namespace handling


From: Stefan Monnier
Subject: Re: Refactoring xml.el namespace handling
Date: 05 Mar 2004 14:29:43 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

>> Thank you.  Here is a counter patch.  The main difference is that it uses
>> 'http://foo/bar rather than :http://foo/bar so as to avoid an unnecessary
>> (concat ":" foo) and also so that (symbol-name foo) immediately returns
>> a usable URL.

> There needs to be a way of differentiating between the (unlikely)
> namespace uri "nil" and "" (that is, no namespace), which is why I believe we
> need to stick with (concat ":" foo).

I must say that I do not know enough of those details to understand what
would be the ideal solution.  I don't see where the confusion between "nil"
and "" could come from, but I do see that using a symbol such as the one
returned by (intern "") can be somewhat inconvenient if you ever want to
print&read the lisp representation.

I would actually recommend to intern all those symbols in a separate obarray
rather than in the main one.  This way you could use nil for the "" case
without interfering with (intern "nil" xml-obarray).  You could also then
use (intern-soft foo xml-obarray) to check whether foo already exists
without getting nasty surprises when foo is the string "nil".
Finally it would avoid polluting the main obarray.

> Also, since I believe we need a prefix, using ':' means less work for
> the programmer since :symbols are automatically interned.  (FWIW, it
> was James Clark who gave me this idea of using ':' as the prefix.)

If a prefix is needed than indeed `:' is fine.  I just feel like there's got
to be a way to avoid it altogether.

> I confess that I'm not very moved by the argument of a usable URL
> since namespace URIs needn't be usable URLs.  My understanding is
> that they are essentially opaque IDs.

You're probably right.  It just seems cleaner without the `:'.

If someone else wants to install this patch, please do.  I don't have time
to look at it just now.


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]