Opinions needed on neg and absolute

chromatic chromatic at wgz.org
Mon Aug 30 22:55:48 UTC 2010


On Monday 30 August 2010 at 15:45, Paul C wrote:

> I have rewritten the Integer 'neg' and 'absolute' operators so they promote 
> the minimum integer to a BigInt when negating it. This is consistent with 
> 'add', 'subtract', etc., all of which promote to BigInt.
 
> I consider the current behavior to be a bug, so that no deprecation is 
> required. What do you think?

Agreed.
 
> As an example of a PMC that inherits from Integer and might rely on the 
> current behavior, I give you Boolean. It inherits 'neg' and relies on the 
> fact that it does not promote to implement the following bizarre behavior:
> 
> -(Boolean true) => true
> -(Boolean false) => false
> 
> I will simply implement 'neg' in Boolean to preserve this whackiness.

While you're at it, can you study how removing Boolean's inheritance from 
Integer might improve the code?

-- c


More information about the parrot-dev mailing list