[Coldstuff] More suggestions

Bruce Mitchener bruce@cubik.org
Fri, 04 Jan 2002 08:37:28 -0700


xmath wrote:

 > Awaiting further comments on waifs.. I have more suggestions:
 >
 > 1. [Genesis] A default method handler: so, if a method call
 > is done and  the method can't be found,
 > $oject.handle_method_call('method, @args) is called.

This could be useful, but the name for it should probably be similar to 
one of the existing languages out there which provides this feature just 
to help make it slightly more familiar.

There are performance issues for this patch, especially in the dev tree. 
  Any code that relies upon calling methods and getting back a ~methodnf 
if it doesn't exist runs much faster in the dev tree because we cache 
negative responses.  This moves some of the handling of that into the 
DB, makes the method cache less effective, etc.

I suspect that you'd like this for doing RPC-based distribution, right? 
  If so, there are other ways that you can accomplish the same end goal 
(distribution) without some of the issues.

 > 2. [Genesis] Why isn't there a way to do bitwise operations (and, or,
 > xor, not). Doing bitwise and is sometimes possible with %, and doing
 > bitwise not is possible by doing (1-value) but it's not as nice..

There are native methods on $integer for this.

 > 3. [Genesis] Support exponentiation of integers:
 > INT pow(INT x, INT y) and optionally FLOAT pow(FLOAT x,
 > INT y) I have fairly efficient implementations for these.
 > (note that the FLOAT-INT pow isn't really necessary as you
 > can use FLOAT-FLOAT pow for that, however INT-INT pow is a
 > really different case.

This should be okay.

 > 4. [Genesis] It's a bit annoying that to convert a negative
 > integer to a negative objnum, I have to do: fromliteral("#"
 > + tostr(num)) because toobjnum doesn't work in that case. Maybe
 > add an optional argument to toobjnum, "allow-negative" ?

What happens if you j ust toobjnum(abs(num)) ?  Is there a reason that 
toobjnum() imposes this restriction?

 > 5. [Genesis] Where is tofrob? To create a frob from variable
 > parameters, I have to do:  frob = fromliteral("<" +
 > toliteral(object) + ", " + toliteral(data) + ", " +
 > toliteral(handler) + ">")   and that's pretty disgusting

What's wrong with just literal data like you would do for a list, 
dictionary, or string:

   <object, data, handler>

?

 > 6. [Genesis] Why does objnum() exist? Why not do toint(this())
 > instead?

Cognitive differences.  You're asking for the objnum.

 > 7. [ColdCore] Add some mechanism to $root to associate custom
 > meta-data with objects, such as custom flags. (yes, I have an
 > application in mind, 'remote to indicate the method may be
 > called by an RPC)

No opinion as I don't work on ColdCore or use it.

 > 8. [ColdCore] There should be some way for programmers to get
 > a list of tasks that are under their controls. So, a
 > programmer-level @tasks and @kill

Same as #7. :)

  - Bruce