Martin Rubey wroteL
>
> Well, I may want to code
>
> if A has CoercibleTo SparseUnivariatePolynomial R
> then ...
>
> This will "work" only for those A for which I have explicitly stated
> CoercibleTo SparseUnivariatePolynomial R.
>
> In a different package, I may want to ask
>
> if A has CoercibleTo UnivariatePolynomial(x, R)
> then ...
>
> Of course, this is not really a problem if there are only two or three
> implementations of univariate polynomials, say A, B and C. In A I say
>
> with { CoercibleTo B; CoercibleTo C; }
>
> in B I say
>
> with { CoercibleTo A; CoercibleTo C; }
>
> in C I say
>
> with { CoercibleTo A; CoercibleTo B; }
>
> But somehow, this looks suboptimal.
>
Martin, I feel that in general there is a problem. But I think
that your example is not the best one. First, new code is
usually less problematic than old code: you can design new
code in such a way that various workarounds work. Real
problem is with old code: we do not want to go back to old
code and re-write all of it. Second, if you deal with single
category you can just test for this category:
if A has UnivariatePolynomialCategory(R) and _
B has UnivariatePolynomialCategory(R) then
....
Third, for coercion it is natural to have a "pivot domain" P,
so that coerce: A -> B is a composition of coercions from
A to P and coercions from P to B.
Let me also mention a more general workaround: for each category
of interest you define special fake domain which serves a label
for your category. Then instead of using:
CoercibleToCat(A, B)
you would use:
CatA(...): Category == Join(Labeled(LabelA(...), ....
(note: LabelA receies the same parameters as CatA, to make sure
that equality of labels implies equality of categories)
CoercibleToCatLabeld(A, B, LabelA): Category == with _
if A has Labeled(LabelA) and B has Labeled(LabelA) then _
coerce: A -> B
Of course, you still have to make sure that labels are available
when needed, but this is part of general Axiom design: you can
not query about domains from outside, you need to have information
passed explicitly.
--
Waldek Hebisch
[EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/fricas-devel?hl=en
-~----------~----~----~----~------~----~------~--~---