Changes between Version 1 and Version 30 of Ticket #20767


Ignore:
Timestamp:
08/03/16 14:32:27 (5 years ago)
Author:
jdemeyer
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #20767

    • Property Status changed from new to needs_review
    • Property Authors changed from to Jeroen Demeyer
    • Property Dependencies changed from #269, #20740, #20753, #20761, #20757 to #21126, #20686, #21139, #21140, #21152, #21153, #21154
    • Property Branch changed from to u/jdemeyer/move_coercion_to_element
    • Property Commit changed from to e1d2ba46574273ec4d358e654ed195a82b81a654
  • Ticket #20767 – Description

    v1 v30  
    11Move all coercion logic from `RingElement`, `ModuleElement` and the like to `Element`.
     2
     3The main consequence is that it matters a lot less whether a class inherits from `Element` or from `ModuleElement`/`RingElement`/`FieldElement`...
     4
     5One difference remains: the more specialized classes have some default implementations for arithmetic. For example, `ModuleElement` implements unary negation as multiplication by -1. The base class `Element` has no default implementations.
     6
     7This patch also affects lookup in categories: with this patch, double-underscore methods like `__add__` are never taken from the category. The `Element` classes take precedence over the category, so the default implementations of certain arithmetic operations will override whatever is in the category. For the base class `Element`, this is not an issue since there are no default implementations.