On Aug 30, 2010, at 3:45 PM, Paul C. Anagnostopoulos wrote:

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.

What's so odd about that? If you think of 'false' as zero, then the inverse of zero equals zero (false) and the inverse of any non-zero integer is non-zero (true, e.g. 1 -> -1). Though if Boolean is a one- bit integer, it must be an unsigned type, and -true will wrap around to true anyway.

Josh


_______________________________________________
http://lists.parrot.org/mailman/listinfo/parrot-dev

Reply via email to