On Oct 28, 2006, at 8:23 PM, William Stein wrote:
> > On Sat, 28 Oct 2006 16:39:10 -0700, David Harvey > <[EMAIL PROTECTED]> wrote: > >> Another issue that slightly complicates this is base rings. When I do >> x * y, I don't always want to coerce into the same parent; sometimes >> I want to coerce x into the "base ring" of y (or vice versa), which >> will mean different things depending on what the rings/algebras are. > > What are the rules for algebras going to be? I'm going to read and think about all of this in a minute, but first I just want to clarify something about the code structure. It looks like the code is organised as follows (either by design, or by inertia). Whenever someone triggers __add__, __mul__ etc, it first goes into one of the abstract base classes RingElement, CommutativeAlgebraElement, ModuleElement, etc. These functions first very quickly test for the most common cases (the cases that need to be really fast) and dispatch to those accordingly. Otherwise, it falls back on the coerce module. Now when something hits the coerce module, it doesn't matter any more whether it got called from RingElement.__add__, or ModuleElement.__add__, or whatever. As far as the coerce module is concerned, the request is just "work out how the hell to add these two things". Is this correct? David --~--~---------~--~----~------------~-------~--~----~ 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://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~----------~----~----~----~------~----~------~--~---