diff options
author | mcclure <andi.m.mcclure@gmail.com> | 2020-09-22 16:36:07 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-22 16:36:07 +0300 |
commit | d95c4d286116611caf029a1f9a86ac03fbe90081 (patch) | |
tree | 16577adf0a92ee044452766f634d81904655bba8 /CHANGELOG.md | |
parent | 7c1205dc0e409540a05eb17e8e99f7f8db653403 (diff) |
Allow inheritance of _init from more than one level up (#289)
* Allow inheritance of _init from more than one level up
Currently _init is exempted from "fat inheritance", and _init inheritance works by a strange workaround where the base class exactly one level up is checked for _init at constructor time. This appears to be done so that :super() can work properly, but it means that _init cannot be inherited from a grandparent.
This patch adds a _parent_with_init field to all relevant classes which points to the most recent ancestor with an _init implementation. This simplifies both __call and _class and might actually be a performance improvement (it removes a loop).
* Add changelog line and tests for grandparent _init
* Add tests: Invocation of a : function inherited from a grandparent; and ensure :super() fails when it ought to fail.
* Prevent a stack overflow when a particular class :super() edge case is hit.
This causes the "createK" test in test-class.lua to fail with a "null function" error instead of a stack overflow.
* Improved fix for :super infinite loop problem (avoid second rawset)
Diffstat (limited to 'CHANGELOG.md')
-rw-r--r-- | CHANGELOG.md | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 61fea88..d5ecccd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 1.x.x (upcoming) + +## Fixes + + - In `pl.class`, `_init` can now be inherited from grandparent (or older ancestor) classes. (#289) + ## 1.8.0 (2020-08-05) ### New features |