Zulip Chat Archive

Stream: new members

Topic: multiple inheritance


Winston Yin (Jun 06 2021 at 04:56):

Is it recommended to set set_option old_structure_cmd true in order for easier multiple inheritance? For example, I'm trying to define a class with extends A →ₗ[k] (V →ₗ[k] V), monoid_hom A (V →ₗ[k] V), so that it is both a linear map in regards to the module structure and a homomorphism in regards to the monoid structure. However, the to_fun field exists in both classes. Otherwise, I'd have to manually copy the fields of one of the two.

Yakov Pechersky (Jun 06 2021 at 05:07):

If you check monoid_hom, you'll see that it extends two classes that both have to_fun also, and uses old_structure.

Eric Wieser (Jun 06 2021 at 07:17):

In your particular case you might be looking for docs#alg_hom?

Eric Wieser (Jun 06 2021 at 07:17):

A →ₐ[k] (V →ₗ[k] V)


Last updated: Dec 20 2023 at 11:08 UTC