-
-
Notifications
You must be signed in to change notification settings - Fork 516
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
sage.rings.abc #32566
Comments
Branch: u/mkoeppe/sage_rings_abc |
Commit: |
Branch pushed to git repo; I updated commit sha1. New commits:
|
Author: Matthias Koeppe |
This comment has been minimized.
This comment has been minimized.
comment:4
I feel like this might go back towards the |
This comment has been minimized.
This comment has been minimized.
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:7
Replying to @tscrim:
In #32414 I now explain that this is expressly not done in order to create a new hierarchy according to mathematical properties. It's really just to make sure that code can test whether an object belongs to a class even if the implementation of that class (the unique direct subclass of the abc) is not installed. |
This comment has been minimized.
This comment has been minimized.
comment:9
Nils' question in https://groups.google.com/g/sage-devel/c/T0A4JCOg9DY/m/yybWDYd6BAAJ whether this new structure incurs a performance penalty can be tested for example on the method |
This comment has been minimized.
This comment has been minimized.
comment:11
Replying to @mkoeppe:
So this is playing the role of a header file does in C? It is just a placeholder effectively saying "we will define this somewhere"? What classes will we have to do this to? All of them? If so, I feels a bit clunky to maintain this manually. Could we do something so that this is automated? Should we try a different mechanism, such as a variation of |
comment:12
Replying to @tscrim:
It's a way to think about it, yes. But it's a placeholder for one specific purpose: Here's a typical example. Anyway, in the proposed approach, we would change So the proposed solution gives a way of enabling modularization (and reducing load times!) with minimal changes to the call site.
Absolutely not. Just those that appear in this kind of code.
Reintroducing A variation of |
Reviewer: Jonathan Kliem |
comment:13
LGTM. |
comment:14
Thanks! |
comment:15
Replying to @mkoeppe:
Okay, thank you for the explanation. I am still slightly worried about scalability and maintenance cost, but we likely have to put it into practice in order to see if it doesn't work.
I feel like this kind of pattern (calling something from "far away") is somewhat common, although I guess there aren't too many things that appear in other subfolders that it applies to. So perhaps it will not be so necessary. Although it might confuse some developers when they have to do this extra step if, say, they need a new algebra to compute something in the combinatorics folder.
I am not suggesting we reintroduce them as I think we should just have more fundamental checks (when possible).
I feel like we are fighting the language more so than anything else. Anyways, it is good to try stuff and see what works. Thank you as always for your work on trying to improve Sage (even more at this scale). |
comment:16
We are surely fighting that cython does not have preprocessor instructions. Would be really nice to have something like
Edit: Actually the above won't ever work, because it boils down to an optional build-dependency. The problem is that modularization will have the consequence that the above decision cannot be made at build-time. |
Changed branch from u/mkoeppe/sage_rings_abc to |
This new module will provide abstract base classes for the purpose of
isinstance
andissubclass
testing. This helps with modularization (#32432).In this ticket, we add
RealField
,RealDoubleField
,ComplexField
,ComplexDoubleField
, which are in 1:1 correspondence to the implementation classesRealField_class
,RealDoubleField_class
,ComplexField_class
,ComplexDoubleField_class
.To illustrate the use of these classes, we convert some uses of
is_...
functions toisinstance
with the new base classes.Related:
Part of meta-ticket #32414.
CC: @tscrim @kliem @videlec @nbruin
Component: refactoring
Author: Matthias Koeppe
Branch/Commit:
6e2c3c4
Reviewer: Jonathan Kliem
Issue created by migration from https://trac.sagemath.org/ticket/32566
The text was updated successfully, but these errors were encountered: