Robert Bradshaw <[EMAIL PROTECTED]> writes: > In Sage, we use the term "coercion" to denote a canonical (using the > term a bit loosely), implicit map between Parents (or objects of a > concrete category). E.g. from ZZ to F5 would be a "coercion," but > there is a "conversion" and not a "coercion" the other direction. > Coercions are invoked to do arithmetic, but conversions are not.
Just for the record, this is *exactly* the same definition as in FriCAS. (in case you wonder, the notation "Object::SomeType" is syntactic sugar for "coerce(Object)@SomeType", where @ is a language builtin, that selects the function according to return type. Unfortunately, the contributors to NAG Axiom were sometimes a bit sloppy about which coercions to implement. There was one idea, which I personally like a lot, to provide to "Categories" (in the FriCAS/Axiom sense) CoercibleTo S, RetractableTo S and ConvertibleTo S that provide coerce: % -> S, coerce: S -> % and retract: % -> S respectively. One can then ask (4) -> SquareMatrix(2, INT) has CoercibleTo Matrix INT (4) true Type: Boolean Very unfortunately, currently in almost all cases the query "has CoercibleTo Something" will return false, because the coerce function is not inherited by the category. (I have a suspicion for the reason, but that's not important here.) However, I think in principle the design is *very* good. I think the design in Sage is not so different (I did not check thoroughly, though), which comes as confirmation. Martin --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---