[Zope3-dev] interface conventions: default=_RAISE_ERROR

Tres Seaver tseaver@zope.com
12 May 2002 19:05:32 -0400


On Sun, 2002-05-12 at 00:00, Gary Poster wrote:
> On Saturday 11 May 2002 07:21 pm, Tres Seaver wrote:
> > On Fri, 2002-05-10 at 20:19, Gary Poster wrote:
> > > My argument is for gracefulness, and perhaps for some small reduction in
> > > fragility.  I think it is clunky, for instance, for the placeful
> > > component architecture functions to have to check for their own default
> > > marker interface and then translate their default marker interface to the
> > > particular service default marker interface, if found.  If you do not
> > > agree with my suggestion, the placeful component architecture functions
> > > have to import the individual markers for each of the services at the top
> > > of the module, the coder has to make sure that the correct service marker
> > > is substituted for the placeful CA marker, and all of a suden you are
> > > talking about a lot of fluff code that just swaps some objects around. 
> > > Why?
> >
> > I would say that clients should *never* explicitly pass the "faux"
> > default argument ('_marker', or whatever) into a function which uses it
> > to declare such a semantic;  the whole point of it is to signal what
> > happens when nothing is passed!  If its name is '_RAISE_ERROR', then
> > it should raise without calling any other underlying function at all,
> > obviating the need to propagate it.
> 
> Yes, you're right; that was a flaw in my argument that essentially negates 
> it.  I could still quibble, but it wouldn't be productive.
> 
> That said, I personally now prefer the readability of default=NotFoundError 
> (or whatever error) as Guido suggested (even while he generally disliked the 
> convention, as Martijn pointed out).
> 
> Tres, should I construe your position as the official ZC position, and remove 
> my Guido-inspired approach from my sandbox, returning to the marker?  Or 
> follow some other course of action?  I have an opinion, which I've stated, 
> but beyond that I have zero interest in debating this issue further: I'd 
> rather just have a community consensus or a papal/ZC directive, and move on.

I was *not* speaking ex cathedra;  only Jim sits there. :)  Our process
is a little weak on the issue of closure, so I am not sure how to
proceed, either.  I think a "pure" marker, one which cannot possibly
be confused with any *real* value passied by a client, is the essence
here;  putting the Exception class in the interface as a default
argument value smells funny, but I could live with it.  I don't think it
removes the need for the "Raises FooError if not found, and no default
is passed" in the docstring, in either case.

Tres.
-- 
===============================================================
Tres Seaver                                tseaver@zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com