Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weaker precondition for registering a new coercion #7421

Closed
nthiery opened this issue Nov 10, 2009 · 9 comments
Closed

Weaker precondition for registering a new coercion #7421

nthiery opened this issue Nov 10, 2009 · 9 comments

Comments

@nthiery
Copy link
Contributor

nthiery commented Nov 10, 2009

With the attached patch, the precondition for registering a new
coercion from P to Q with register_coercion becomes:

"no coercion into P has been queried, or no coercion from P to Q has been registered or discovered earlier"

Which is a bit weaker than the previous:

"no coercion into P has been queried"

This should still be quite safe, while covering all the formerly
problematic practical use cases coming up in the category code #5981.

CC: @sagetrac-sage-combinat @robertwb

Component: coercion

Author: Nicolas M. Thiéry

Reviewer: Robert Bradshaw

Merged: sage-4.3.alpha0

Issue created by migration from https://trac.sagemath.org/ticket/7421

@mwhansen
Copy link
Contributor

comment:2

I think is probably okay. After thinking about it for a bit, I could come up with a situation where this change would make the coercion graph non-commutatitve.

I'll run all the tests with it here in a bit.

@williamstein williamstein modified the milestones: sage-4.3, sage-4.2.1 Nov 11, 2009
@robertwb
Copy link
Contributor

comment:4

There is one way this can go wrong. Suppose one has B -> C, and one wants to register A -> B. If A -> C was previously requested, its non-existence will be cached.

Now I don't think this will be an issue in practice, nor does _unset_coercions_used solve it.

@nthiery

This comment has been minimized.

@nthiery
Copy link
Contributor Author

nthiery commented Nov 11, 2009

comment:6

With the updated patch register_coercion also does not bark if _coercions_used is false.

Otherwise, this triggered to failing doctests in sage/modules/fg_pid/fgp_module.py
and sage/modules/fg_pid/fgp_morphism.py. An expert should investigate why a coercion gets registered twice in those modules, and whether this is not a bug. But I vote for postponing that for later.

@nthiery
Copy link
Contributor Author

nthiery commented Nov 11, 2009

comment:7

Replying to @robertwb:

There is one way this can go wrong. Suppose one has B -> C, and one wants to register A -> B. If A -> C was previously requested, its non-existence will be cached.

Now I don't think this will be an issue in practice, nor does _unset_coercions_used solve it.

I agree.

So, is this positive review?

@nthiery
Copy link
Contributor Author

nthiery commented Nov 11, 2009

The previous version was missing a patch header.

@mwhansen
Copy link
Contributor

comment:8

Attachment: trac_7421-register_coercion_weaker_assertion.patch.gz

I'm going to move this to 4.3 where it's more relevant.

@mwhansen mwhansen modified the milestones: sage-4.2.1, sage-4.3 Nov 13, 2009
@robertwb
Copy link
Contributor

comment:9

Yes, positive review.

@mwhansen
Copy link
Contributor

Merged: sage-4.3.alpha0

@sagetrac-mvngu sagetrac-mvngu mannequin changed the title Weaker precondition for registering a new coercion. Weaker precondition for registering a new coercion Dec 26, 2009
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants