Skip to content

Add Prototype Multiple Inheritance #311

@Skeats

Description

@Skeats

Hey there! While using this plugin, I have found myself desiring multiple inheritance for prototypes. I have never contributed to something like this, however I have taken a very quick glance into the code and it seems feasible to implement, so if you aren't opposed I could try my hand at it.

My initial thoughts for how this would work would simply be to store the inherited prototypes as an array. like so:

{
	"base_prototype": {
		"some_property": "Hello, World!"
	},

	"base_prototype_2": {
		"another_property": "Inheritance is cool"
	},

	"multiple_inherited_prototype": {
		"inherits": ["base_prototype", "base_prototype_2"]
	}
}

I don't think it would be difficult to support the old "single inheritance" syntax alongside this new syntax, thus not breaking any existing protosets. The only other problem would be managing cases where inherited prototypes have identical properties. We would need to decide if inherited prototypes can override properties or not; The most elegant solution I can think of at the moment is to have an "important" property, any properties inside of which would override any other inherited prototypes, but that would be better left for a different issue, I think.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions