#6097: [with patch, needs review] Implements a mantra for declaring abstract
methods
-------------------------+--------------------------------------------------
Reporter: nthiery | Owner: nthiery
Type: enhancement | Status: assigned
Priority: major | Milestone: sage-4.0.2
Component: misc | Keywords: abstract methods
Reviewer: | Author: nthiery
Merged: |
-------------------------+--------------------------------------------------
Comment(by nthiery):
Replying to [comment:9 ncalexan]:
> > My point is: the issue is non trivial enough that it requires more
experience and further debate (not just the two of us). And we do not have
the time for this right now.
>
> Wait, what is the rush?
The category patches + followers depend on this. Total 22 patches = 1.3 Mb
:-)
> > So what? The class of this object is broken in the first place.
>
> I think there is a significant difference between broken *functionality*
and an object in the system that cannot be *interrogated* by the system.
Fair enough.
> > On the other hand, experience with MuPAD, tells that having early
errors for such situations is much safer (note that a bound method need
not be called immediately; instead it can be passed down to other
functions and wreak havoc at a distant place later).
>
> This is often true. Can you guarantee that such a poisoned object can
only be created by a user who "works hard" to do so? If that's the case
then I remove whatever objections I have.
In principle, such objects can only be created by:
- Instantiating an instance of an abstract class (which should not be
permitted in the first place)
- Instantiating an instance of a concrete class which does not implement
all the mandatory abstract methods of it super class
- Or shooting in your own foot, and creating the abstract_method
yourself, as in the doctest.
I don't know how much "hard word" is the first point.
The second point can only occur if:
- either the user wrote the class himself (which sounds hard enough work)
- or if a developer did not do his job (or worst, the code went into sage
through refereeing!)
Note that the category code includes checking methods that complains if a
parent does not implement all the mandatory abstract methods.
I plan to lift this up to SageObject.
That being said, as a dev, I got caught myself at least once. So it's all
a question of balance between two annoyances.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/6097#comment:10>
Sage <http://sagemath.org/>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sage-trac" 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/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---