Trans wrote:

On Jul 17, 3:08 pm, Charlie Savage <[EMAIL PROTECTED]> wrote:

Well, that is also a breaking change though.

I guess I should change the code to just do include LibXM::XML in
libxml.rb.

You mean 'include LibXML'

Right, sorry.

It does defeat the whole purpose, and the purpose is a very important
one. Not only does it follow the expectation that 'libxml' provides
LibXML, but it allows people to reuse the library without worrying
about others using the same namespace. This is how Ruby libraries
should be written. I recall years ago that it was not uncommon to see
an include right after a require. Back then I didn't understand it. It
seemed like a waste. But over time it has become clear to me why it
so. It makes a library much more robust. Let me give you an example. I
once created a library like Builder. And it worked simply enough:

  XML.root { foo "bar" }

produced

  <root><foo>bar</foo></root>

So here we have and XML namespace being used. If I wanted to use this
lib and the old LibXML at the same time, I'd have issues and would
have to do some kooky work around. Hey, but I'm a smart kid, and my
lib, at the time, had a general name (with a bunch of other stuff in
it too) called Blow. So I had, Blow::XML. Now I'm safe. Other's
however are not. It took me about three minutes to find:

  http://xml-mapping.rubyforge.org/

I'm sure there are others. XML:: is a common namespace. It stands to
reason, of course. And we want to be able to use it too. To do so, as
a good custodian of Ruby namespaces, means wrapping it in a module
reflecting our libraries project name.

I agree with all the above, but its kind of a moot point, no?

Keep in mind that up until a few months ago the require was 'xml/
libmxl'. And that is still supported. So there really hasn't a whole
lot of time for people to get too attached to 'libxml'. We should just
do it and get it over with so it's solid and there's no more trouble
in the future.

Hmm, that is a good point.  Except I thought it was deprecated.

Anyway, what I think you're saying is for the following files:

----
xml/libxml.rb

include LibXML

------
libxml.rb

.. do nothing ...

--------
xml.rb

include LibXML

----

Right? With of course an obvious problem that require 'xml' is surely going to conflict with someone else - putting us back with the same problem.

Charlie





T.
_______________________________________________
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

Reply via email to