[XML-SIG] getDOMImplementation() extension

Thomas B. Passin tpassin@comcast.net
Tue, 05 Nov 2002 19:28:17 -0500


[Martin v. Loewis]

> "Fred L. Drake, Jr." <fdrake@acm.org> writes:
>
> > As I consider in my response to Ray's comments:
> >
> > http://lists.w3.org/Archives/Public/www-dom/2002OctDec/0109.html
> >
> > the right approach may be to have a second function (either somewhere
> > else or with a different name) that does implement the W3C API for
> > this, but the overloading of the name may well not be the right way to
> > go about this.
>
> Here I strongly disagree: If we have a function getDOMImplementation,
> then people *will* expect this to be the W3C function, regardless of
> the documentation saying that we have renamed this function.
>
> If people think that it would really be better to return None instead
> of raising an exception if no implementation can be found, I'd say
> that it is acceptable to break the API here: Few people will be
> affected, IMO, and they can readily support multiple versions:
>

We could deprecate the old behavior and provide a means to phase it out over
time -

'''Returns ImportError if errorstyle == 'oldstyle', or None is errorstyle
=='newstyle'.
The old style is deprecated.  In two more releases, the default will be
changed to
'newstyle'.'''
try:
  impl = xml.dom.getDOMImplementation(features, errorstyle='oldstyle')
except ImportError:
  impl = None
if impl is None:
  process error

No one's code will break for a long time, if ever, new code can use the new
style, and eventually, the errorstyle parameter can be eliminated.

Cheers,

Tom P