Ability to inherit multiple classes #198

Open
opened 2025-12-30 01:22:02 +01:00 by adam · 1 comment
Owner

Originally created by @sandeshworld on GitHub (Aug 7, 2024).

I think being able to extend multiple classes would improve usability quite a bit!

The following is currently possible:

class Parrot extends Pigeon {   
  name = "Parrot"               
  diet = "Berries"              
  extinct = false               

  function say() = "Pkl is great!"   
}

It would be useful to also be able to do something like:

class Parrot extends Pigeon, Pet {   
  name = "Parrot"               
  diet = "Berries"              
  extinct = false               

  function say() = "Pkl is great!"   
}
Originally created by @sandeshworld on GitHub (Aug 7, 2024). I think being able to extend multiple classes would improve usability quite a bit! The following is currently possible: ``` class Parrot extends Pigeon { name = "Parrot" diet = "Berries" extinct = false function say() = "Pkl is great!" } ``` It would be useful to also be able to do something like: ``` class Parrot extends Pigeon, Pet { name = "Parrot" diet = "Berries" extinct = false function say() = "Pkl is great!" } ```
Author
Owner

@holzensp commented on GitHub (Aug 20, 2024):

This would need signficantly more detail (motivation, how to resolve the diamond problem, etc, etc). This is generally a problem in (nominative) hierarchical type systems, so without further restrictions/requirements, this ask can't be satisfied.

@holzensp commented on GitHub (Aug 20, 2024): This would need _signficantly_ more detail (motivation, how to resolve the [diamond problem](https://en.wikipedia.org/wiki/Multiple_inheritance#The_diamond_problem), etc, etc). This is generally a problem in (nominative) hierarchical type systems, so without further restrictions/requirements, this ask can't be satisfied.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pkl#198