Bug 47884 - should we allow multiple inheritance in python code in webkit?
Summary: should we allow multiple inheritance in python code in webkit?
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nobody
Depends on:
Reported: 2010-10-18 22:54 PDT by Dirk Pranke
Modified: 2010-10-21 16:42 PDT (History)
5 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Pranke 2010-10-18 22:54:17 PDT
See bug 47874 for some background ... there are places in the code where using MI would make the code cleaner, like webkitpy/layout_tests/port/{google_chrome,chromium_gpu}.py , where the classes naturally want some sort of diamond and/or mixin behavior, and we resort to unpleasantness in its absence.
Comment 1 Adam Barth 2010-10-18 22:57:05 PDT
We use multiple inheritance in a bunch of places in webkitpy, mostly int the Mixin pattern.
Comment 2 Adam Barth 2010-10-18 22:57:30 PDT
Actually, also to inherit from "pure virtual" interfaces.
Comment 3 Tony Chang 2010-10-19 09:56:48 PDT
I'm fine with pure virtual interfaces and to a lesser degree, mixin.

The proper way to refactor the google_chrome and chromium_gpu ports would be to have delegate classes for specific functionality of a port.  For example, having a delegate that provides a few path functions (e.g., baseline search path and path to expectations) and have it be a member variable of Port.  This could also be done via mixins, but I think the delegate pattern is more widely used in WebKit code.
Comment 4 Tony Chang 2010-10-19 09:59:07 PDT
To clarify, I think what we want to avoid is a GPU port and a Linux port where we inherit from both to make a Linux GPU port.  That would be confusing because you don't know what functions are provided by which base class.
Comment 5 Dirk Pranke 2010-10-21 16:42:16 PDT
I think I will consider this closed as "yes, with caution". Anyone please reopen or comment if you disagree :)