Do we "own" XML namespace?

Hi–

Little bit of debate going on with LibXML, and I’d like to get some
general feed back.

Currently the module namespace used by libxml-ruby is “XML”, so we see
code like:

require ‘libxml’

XML::Document.new

The question is whether that’s fair, since it sort of lays claim to
“XML” as owned by the libxml project. It also means the libraries name
does not correspond to the top module name. So we are considering
instead switching to:

LibXML::Document.new

(though we would leave backward compatibility in for a while). Another
option is:

LibXML::XML::Document.new

since one can always do

include LibXML

to get the same functionality that we have now.

What do others think? What is the best/proper approach here?

Thanks,
T.

On Mon, Jul 14, 2008 at 10:40 AM, Trans [email protected] wrote:

(though we would leave backward compatibility in for a while). Another
option is:

LibXML::XML::Document.new

since one can always do

include LibXML

to get the same functionality that we have now.

I like this one - it lets you use the XML namespace without
monopolising it. It also allows someone writing a drop-in replacement
for LibXML to use the same trick and have code switch effortlessly
between the two.

martin

Some thoughts…

LibXML::XML::Document.new

since one can always do

include LibXML

So I didn’t actually do that. Instead, I moved LibXML into a new
LibXML module.

So:

LibXML::Document.new

Then for backwards compatibility in libxml.rb:

module XML
include LibXML
end

I prefer this approach because having to type in LibXML::XML
constantly would be annoying (sure you could do an include, but that
would also be annoying). Since we’re making this change, let’s make
sure that future usage of the API is a pleasant as possible.

I like this one - it lets you use the XML namespace without
monopolising it. It also allows someone writing a drop-in replacement
for LibXML to use the same trick and have code switch effortlessly
between the two.

Right - and that should still work exactly the same. You’d have to
either uncomment out the libxml require code (true for both
approaches), or remove the XML module and replace it with your own
(also true for both approaches).

Charlie

cfis [email protected] wrote:

LibXML module.

So:

LibXML::Document.new

Charlie - sounds great, just yell real loud when the gem update
implementing this change comes online… :slight_smile: Thx! - m.