[Coldstuff] First version of waif-patch

Brandon Gillespie brandon@roguetrader.com
Fri, 4 Jan 2002 08:35:27 -0700


On Fri, Jan 04, 2002 at 01:09:45PM +0100, Matthijs van Duin wrote:
> >Also, negative object numbers happen when an object becomes invalid. 
> >(So, #2 becomes #-2 if you destroy it.)  So, the changes to how 
> >objnums are compared doesn't look correct to me.
> 
> I'm fairly sure it can never go wrong, because I only use negative 
> obj#s for waifs in places where invalid objects cannot occur.
> 
> In places where invalid objects *can* occur, they're in a cData where 
> I can check the actual type (WAIF / OBJNUM).

negative object nums can appear in the entire negative numeric range.
If you had object #14524342 and destroyed it, the objnum would become
#-14524342, so there are no gaps which can be filled in (cold doesn't
handle invalid objnums like MOO does).

> >The things that return ~waif when there is an error should return 
> >~type usually.  ~type indicates that something wasn't of the correct 
> >~type and is something that code can and should be able to expect.
> 
> You don't expect ~type when calling obj.add_method(). I deliberately 
> didn't use ~type because WAIFs and OBJs *are* treated as the same 
> type in most of the functions. Only very few functions do something 
> that you can't do on waifs, so *only* in those cases I throw ~waif 
> (for example, del_method() will simply fail with ~methodnf). So using 
> ~type would actually be inconsistent in those cases.

I think the intent Bruce had was to try to not add new error names
wherever possible, so as to brake as litte existing code as possible.
If you want it to be synonymous with objects, you may want to throw an
object error instead of ~waif.
 
-Brandon