#12808: Optimize ClassCallMetaClass using Cython
--------------------------------------------------+-------------------------
Reporter: hivert | Owner: jason
Type: enhancement | Status: new
Priority: major | Milestone: sage-5.0
Component: misc | Resolution:
Keywords: classcall UniqueRepresentation | Work issues:
Report Upstream: N/A | Reviewers:
Authors: Florent Hivert | Merged in:
Dependencies: | Stopgaps:
--------------------------------------------------+-------------------------
Comment (by SimonKing):
Or ideally, one could try to provide a generalised metaclass framework in
Sage. Namely, one could think of having different small metaclasses, each
providing a particular feature. For example:
* We have `NestedMetaclass`.
* We already have `__classcall__` (perhaps resulting in a unique parent
structure or in a dynamic class).
* At #11794, I suggest a metaclass that provides a fast cached hash.
* Just "brainstorming": Perhaps it would be a useful feature for
debugging to print which Python methods are called of a particular
instance. I could imagine a metaclass that could be used to
''temporarily'' switch that feature on.
And if we have different "small" metaclasses then it would be useful to
combine them. But that's a problem for Python: If A, B and C have
different metaclasses, you can not simply have a class definition like
{{{
class D(A,B,C): pass
}}}
This is (I guess) why `ClasscallMetaclass` inherits from
`NestedMetaclass`. But Ticket #11794 provides examples for a different and
more skalable solution: ''Make metaclasses dynamic!''
So, what I mean by a generalised metaclass framework in Sage is:
* Implement a base class `SageMetaclass`, from which all metaclasses
(such as `NestedMetaclass` and `ClasscallMetaclass` and
`FastHashMetaclass`) are derived.
* Make it so that if A, B, C are classes with different metaclasses (all
derived from `SageMetaclass`) can be used as base classes for a new class.
In that way, the features provided by metaclasses could be freely
combined.
But I guess that's a topic for a different ticket...
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12808#comment:6>
Sage <http://www.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.