On Mon, Aug 25, 2014 at 1:24 PM, Bill Hart <goodwillh...@googlemail.com> wrote:
>> > Correct. But classes are essentially objects in Python because >> > everything is >> > an object, pretty much. This really muddies the water. Better to think >> > of >> > classes and objects as being separate concepts. >> >> I, for one, find it very convenient (especially compared to using >> reflection and other hacks that are needed to reason about type at >> runtime in C++ or Java). Not that some languages aren't even better. >> >> > Also better to think of ZZ as a class in Sage and elements of ZZ as >> > objects, >> > even though actually ZZ happens to be an object too because Python. >> >> No. ZZ is an object because you might want to do things with it, like >> ask for it's properties (is it infinite?) > > Sorry if I have that wrong. But when I type ZZ?? into Sage, it pulls up the > definition of a class. If a is an instance of class A, typing a?? will give you the definition of A. > Anyway, it's irrelevant because Python. > > In Julia types are also able to be passed around as first class objects. > Which means you can define multimethods which take types as parameters. I do > this all the time in Nemo. > > So I can send a type to a function which gives me some properties of the > type, if I so wish. I thought about adding properties like is_infinite to > types in Nemo. But I found that I had been thinking the wrong way about > things all along. Good, because I was worried there for a minute you were praising Julia for not treating types as first class objects. >> or use it as a parameter >> (e.g. the domain of a Map object). Sometimes the Objects (in the >> categorical sense) are more interesting than their elements. > > If you are a category theorist yes. Most mathematicians think categories are > just sets. > >> >> If your Objects are parameterized types, >> >> I'm curious how you handle in >> Julia the fact that R[x] is a Euclidean domain iff R is a field. > > I'm curious, is the category of Euclidean domains a full subcategory of > Rings? I think so; the Euclidean property doesn't place any constraint on the morphisms. I am still curious how you would express that UnivariatePolynomialRing{QQ} <: EuclideanDomans but the same doesn't hold for UnivariatePolynomialRing{ZZ} in Julia. >> (As >> you mention, trying to use the type hierarchy in Python to model >> categorical relationships in Sage has generally lead to pain which is >> why we're moving away from that...) > > Oh I can't think why. I buy that the type system is more powerful in Julia (yay), but I'm still skeptical that it is the best way to express the relationship between objects and categories, and at the same time elements and objects, and attach useful information to those categories and objects. - Robert -- 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.