LearnNewsExamplesServices
Frontmatter
id6905
titleEnhance Mixin System: Automatically Merge static config from Mixins
stateClosed
labels
enhancement
assignees[]
createdAtJun 30, 2025, 3:21 AM
updatedAtOct 23, 2025, 12:56 AM
githubUrlhttps://github.com/neomjs/neo/issues/6905
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJul 8, 2025, 11:04 PM

Enhance Mixin System: Automatically Merge static config from Mixins

Closed v10.0.0-beta.5 enhancement
tobiu
tobiu commented on Jun 30, 2025, 3:21 AM

Currently, the Neo.mjs mixin system, implemented via applyMixins in src/Neo.mjs, effectively copies methods from mixins to the target class's prototype. However, it does not automatically merge the static config properties defined within mixins into the static config of the class that consumes them.

This behavior means that default configuration values or new configurable properties introduced by a mixin are not automatically inherited by the consuming class. Developers are required to manually replicate or merge these configurations, which introduces boilerplate, increases the risk of errors, and diminishes the "plug-and-play" benefit of mixins for configuration.

Proposed Enhancement:

Modify the applyMixins function (or the Neo.setupClass process where mixins are applied) to intelligently merge the static config of each applied mixin into the static config of the target class. This merge should respect the inheritance hierarchy, allowing the consuming class's own static config to override mixin configs, and later mixins to override earlier ones (or a defined merge strategy).

Benefits:

  • Reduced Boilerplate: Eliminates the need for manual config merging in consuming classes.
  • Improved Maintainability: Configuration defaults and new configurable properties introduced by mixins are automatically applied.
  • Enhanced Developer Experience: Mixins become more powerful and intuitive for sharing not just behavior, but also configurable state.
  • Consistency: Aligns the mixin system more closely with the declarative nature of Neo.mjs's config system.
tobiu added the enhancement label on Jun 30, 2025, 3:21 AM
tobiu referenced in commit 1a4bbfb - "Enhance Mixin System: Automatically Merge static config from Mixins #6905 exploration inside a new feature branch" on Jul 8, 2025, 3:14 PM
tobiu referenced in commit 31c60d2 - "#6905 exploration WIP" on Jul 8, 2025, 4:18 PM
tobiu referenced in commit 3bf40d4 - "#6905 Added test testing class into the current feature branch, to not lose it." on Jul 8, 2025, 9:05 PM
tobiu referenced in commit 8fc891c - "Enhance Mixin System: Automatically Merge static config from Mixins #6905" on Jul 8, 2025, 10:44 PM
tobiu
tobiu Jul 8, 2025, 11:04 PM
Image
tobiu closed this issue on Jul 8, 2025, 11:04 PM
tobiu referenced in commit 3e475e6 - "#6905 Added test testing class into the current feature branch, to not lose it." on Jul 9, 2025, 2:10 AM
tobiu referenced in commit 9feb51e - "Enhance Mixin System: Automatically Merge static config from Mixins #6905" on Jul 9, 2025, 2:10 AM