ExtensionMethods
From APIDesign
(Difference between revisions)
Line 2: | Line 2: | ||
The basic idea is to avoid extending [[RootClass]] ''physically'', but rather extend it ''virtually'' via a lexical compilation scope. | The basic idea is to avoid extending [[RootClass]] ''physically'', but rather extend it ''virtually'' via a lexical compilation scope. | ||
+ | |||
+ | See [[wikipedia:Extension_method]] explanation which may agree or contradict my view. |
Current revision
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.
See wikipedia:Extension_method explanation which may agree or contradict my view.