Re: embedding, getargs/mkvalue asymmetry

Donald Beaudry (don@dvcorp.com)
Wed, 08 Feb 1995 19:07:26 -0500

> In 1.2, mkvalue() will support "O&". I can send the patches if you
> want them. I believe O! and O? are not useful for mkvalue(). (Beta
> testers: this is not yet in beta-2; it will be in beta-3.)

At first I thought the same thing about "O!" and "O?" from within
mkvalue(), but then I thought again. The purpose they serve is simply
one of type checking, just like in getargs(). It seems to me that if
you got a few object from somewhere and needed to pack them up into a
tuple for some reason,

t = mkvalue("(O!O?)", &Inttype, obj1, in_some_range, obj2);
if (! t)
return NULL;

is a bit nicer to read and write than

if (! isintobject(obj1) && ! in_some_range(obj2)) {
err_set_string(TypeError, "bogus objects")
return NULL;
}
t = mkvalue("(OO)", obj1, obj2);
if (! t)
return NULL;

In addition to having cleaner code, this allows mkvalue() to set up
the exception, which will gives the added bonus of more consistant
error messages.

--
Donald Beaudry                                DataViews Corporation
Software Engineer                             47 Pleasant Street
don@dvcorp.com                                Northampton, MA 01060
		  "So much code, so little time..."