Zulip Chat Archive

Stream: general

Topic: extending two extensions of a structure without redundancy


Dean Young (Mar 11 2023 at 10:10):

If two structures extend a common substructure, then does their mutual extension know not to duplicate the items in the common substructure?

Alistair Tucker (Mar 11 2023 at 10:33):

According to Functional Programming in Lean (about Lean 4): "Structures may inherit from other structures. Behind the scenes, a structure that inherits from another structure contains an instance of the original structure as a field. In other words, inheritance is implemented with composition. When multiple inheritance is used, only the unique fields from the additional parent structures are used to avoid a diamond problem, and the functions that would normally extract the parent value are instead organized to construct one. Record dot notation takes structure inheritance into account."


Last updated: Dec 20 2023 at 11:08 UTC