[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Axiom-developer] categories with parameters and defaults
From: |
Page, Bill |
Subject: |
[Axiom-developer] categories with parameters and defaults |
Date: |
Tue, 14 Mar 2006 13:09:43 -0500 |
Ralf,
On Tuesday, March 14, 2006 9:58 AM you wrote:
> I wrote:
> > I suppose it would be better to write:
> >
> > default {
> > Rep == T;
> > square(t: %): % == per(m(rep(t), rep(t))
> > }
>
> NOOOO.... PLEASE DONT USE ANY REPRESENTATION IN A CATEGORY.
The 'Rep' is not a representation in a category. It is in
the default implementation of 'square' which is implemented
in some domain which satisfies this category.
Perhaps you might object that such defaults are best thought
of as virtual packages. I agree that in SPAD that that is how
they are implemented. But we still need to worry about
representation since ultimately they are used in the context
of some domain which satisfies the corresponding category.
>
> Suppose someone later implements your category and just
> uses some other representation than T.
Say what? ;) This default clause is just part of the
definition of a category where T is a parameter of the category,
e.g. Martin's 'MyMonoid'. What type T represents depends on how
this category is "called", e.g. in
MyMonoid(Integer, *$Integer)
T is Integer, so we have the representation
Rep == Integer;
In other cases we have other representations
Regards,
Bill Page.
- [Axiom-developer] categories with parameters and defaults,
Page, Bill <=