On Mon, Mar 10, 2014 at 07:02:40AM -0700, Niles Johnson wrote: > I would prefer not to use "mathematical context" or "semantic" when trying > to read code (for debugging, or for learning). My reason for this is that > I don't believe the computer "knows" mathematics, so I wouldn't use my > mathematical knowledge to try to guess what the code is doing. Using > mathematical or other semantic information is useful to guess what > developers were thinking when they wrote the code. But (especially when > debugging) I don't assume that every developer knows what I know. > Therefore I will want a more reliable way to determine where/how methods > are implemented.
Hmm, as is, the argument is a bit general, and I believe it would rule out the very principle underlying categories :-) So let's make this more concrete. Here is the kind of knowledge we are speaking about: - a finite field is a ring, but also a finite set, etc. - a unital magma that is associative is a unital semigroup, that is a monoid - a finite division ring is a field Sage "knows" about those, either because the information is directly hardcoded (e.g. a unital semigroup is a monoid, a finite division ring is a field), or deduced iteratively from such. The role of categories is to make the code manageable by using more deductions to reduce the amount of information you need to hardcode. Similar strategies have been successfully used in one form or the other in GAP, Magma, Axiom, MuPAD, and since we are getting bigger than those, we are exploring further. As an analogy, in plain Python, when one creates a class one does not hard code all the super classes. Only the direct ones. And as in plain Python, the easiest way to recover where/how a method is implemented is to use introspection (rather than exploring the hierarchy by looking at the code). This being said, where would you put the threshold between appropriate and overboard use of "math knowledge"? 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-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.