ExtensionMethods

From APIDesign

(Difference between revisions)
Jump to: navigation, search
(New page: A way to extend RootClass (or any other class) with functionality without ''disturbing others''. Way better than DefaultMethods. Used in Kotlin. And also in Enso.)
Line 1: Line 1:
A way to extend [[RootClass]] (or any other class) with functionality without ''disturbing others''. Way better than [[DefaultMethods]]. Used in [[Kotlin]]. And also in [[Enso]].
A way to extend [[RootClass]] (or any other class) with functionality without ''disturbing others''. Way better than [[DefaultMethods]]. Used in [[Kotlin]]. And also in [[Enso]].
 +
 +
The basic idea is to avoid extending [[RootClass]] ''physically'', but rather extend it ''virtually'' via a lexical compilation scope.

Revision as of 06:07, 10 September 2025

A way to extend RootClass (or any other class) with functionality without disturbing others. Way better than DefaultMethods. Used in Kotlin. And also in Enso.

The basic idea is to avoid extending RootClass physically, but rather extend it virtually via a lexical compilation scope.

Personal tools
buy