Dear all, Following the discussion with Paul-Olivier, I became convinced that the very tolerant conversions provided by CombinatorialFreeModule are *harmful*, and that we have to disable them. And then, if needed, think seriously about which mathematically meaningful conversions we really want, and how to implement them safely. Here is a piece of the current doc of _element_constructor, after a patch I just wrote:
Conversions between distinct free modules are not allowed any more:: sage: F = CombinatorialFreeModule(ZZ, ["a", "b"]); F.rename("F") sage: G = CombinatorialFreeModule(QQ, ["a", "b"]); G.rename("G") sage: H = CombinatorialFreeModule(ZZ, ["a", "b", "c"]); H.rename("H") sage: G(F.term("a")) Traceback (most recent call last): ... TypeError: do not know how to make x (= B['a']) an element of self (=G) sage: H(F.term("a")) Traceback (most recent call last): ... TypeError: do not know how to make x (= B['a']) an element of self (=H) Here is a real life example illustrating that this yielded mathematically wrong results:: sage: S = SymmetricFunctions(QQ) sage: s = S.s(); p = S.p() sage: ss = tensor([s,s]); pp = tensor([p,p]) sage: a = tensor((s[5],s[5])) sage: pp(a) # used to yield p[[5]] # p[[5]] Traceback (most recent call last): ... NotImplementedError Extensions of the ground ring should probably be reintroduced at some point, but via coercions, and with stronger sanity checks (ensuring that the codomain is really obtained by extending the scalar of the domain; checking that they share the same class is not sufficient). Comments, thought? Cheers, Nicolas -- Nicolas M. ThiƩry "Isil" <nthi...@users.sf.net> http://Nicolas.Thiery.name/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sage-combinat-devel" group. To post to this group, send email to sage-combinat-devel@googlegroups.com To unsubscribe from this group, send email to sage-combinat-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en -~----------~----~----~----~------~----~------~--~---