Hi William, On Apr 29, 7:21 am, William Stein <[email protected]> wrote: > ... > The T-shirt I'm wearing says -- "It's easy. Implement it and post a patch."
I know, and I already started to do so. I got it to work for the FractionField functor, and I think I have a reasonable framework both for mapping objects and morphisms: * The default call method of a functor would first coerce its argument into the functor's domain. Hence, if there is a functor from, say, fields to fields, and the argument is ZZ, then no error is thrown; instead, it is first transformed into QQ. Not always wanted, I guess... --> I suggest to use a new magical method _coerce_into_domain, that by default just raises an error if the argument does not belong to the domain, and returns its argument otherwise. A user may overload it by, say, coercion. * For dealing with morphisms, I suggest to use a new magical method _apply_functor_to_morphism, that deals with it. * There already is a magical method _apply_functor for mapping objects -- but it isn't used! My impression is that it was intended that any subclass of "Functor" implements it, and then the default __call__ method uses it. But the default __call__ method has no return value (bug), and thus all functors implemented their own __call__ method. --> I am creating a default __call__ method that should not be overloaded, and relies on _coerce_into_domain, _apply_functor and _apply_functor_to_morphism. But related with it, I asked another question, see http://groups.google.com/group/sage-support/browse_thread/thread/73fa193c4540ff96 : If one has a ring homomorphism R-->S, how does one create induced homomorphisms R['a','b',...] --> S['a','b',...] or MatrixSpace(R,m,n) --> MatrixSpace(S,m,n) or LaurentPolynomialRing(R,...) --> LaurentPolynomialRing(S,...) ?? I would then plug this construction into the to-be-created _apply_functor_to_morphism methods of the construction functors, and submit a patch. Cheers, Simon -- To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
