There are two things going on that I had thought were coupled together, but 
are actually not:

1 - The construction of the dynamic class element_class, which is currently 
done by Parent.__make_element_class__, which in turn indirectly calls 
Category._make_named_class via @lazy_attribute Category.element_class via 
@lazy_attribute _abstract_element_class.
2 - The initialization of a default _element_constructor_ method, which is 
done mostly in the category but there is some logic in Parent to set this 
(that should fundamentally be removed).

So everything I said above is primarily focused on 2, whereas the main 
issue is 1 and is separate from 2.

>
> Is there a use case where having this in Parent would be preferable? 
>
> My impression of the general idea is to consolidate and simplify the logic 
to make maintenance easier. I do not think we would get much of a speed 
benefit because constructing the element class should only be done once. 
Although I do not see a reason why a subcategory would want to override 
_make_named_class or have a specific element_class (to me, this breaks the 
abstraction that categories are support to have).

Part of me would like to see this logic in Element, where it dynamically 
changes/sets its class upon creation. That way, we could simply create an 
elissueement class of any type and still retain the category information, 
so we could easily have homsets with multiple element classes. 
Unfortunately I think this would significantly slow down element creation 
as all of this class and category information would have to be processed on 
every creation.

Since the element_class is really something that is used by the parent, IMO 
it is better to be in Parent than in the category. I also think if we can 
streamline some of this code, it will be easier to construct multiple 
element classes for a given parent.

Best,
Travis

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to