GitHub user rectang opened a pull request:
https://github.com/apache/lucy-clownfish/pull/16
CLOWNFISH-9 Mark most types final
Mark most core types as `final`: Blob, ByteBuf, CharBuf, Class, Method,
Hash, HashIterator, Vector, and the concrete Num types.
Conspicuous omissions include Obj and Err which need to be extensible, and
String and StringIterator, which need to be refactored to accommodate stack
allocations without subclassing.
Commit 9a71917, "Export all _IMP symbols" is a bit like swatting a fly with
a sledgehammer, but without it, Lucy fails dynamic linking because
`CFISH_Num_Equals_IMP` is not exported. I think that over time as more classes
are properly marked as `final` and closed off from extensibility, it will have
less impact.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/rectang/lucy-clownfish
CLOWNFISH-9-most-types-final
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/lucy-clownfish/pull/16.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #16
----
commit f5ad7777d217e8466aa0c32ee1590636ac1e9fd3
Author: Marvin Humphrey <[email protected]>
Date: 2015-05-09T01:06:16Z
Make PerlSub helpers more flexible.
Add an extra argument, `first`, controlling which params to include.
Don't force the first argument name to `self`.
commit 19d7b7508745a49b725f623da8af159fd21200ff
Author: Marvin Humphrey <[email protected]>
Date: 2015-05-09T01:22:31Z
Bind different func to XS ctor for final classes.
For final classes, look for `new`. For extensible classes, look for
`init`.
The effect is to prevent Perl-space subclassing of final classes.
commit 3c977c58f7a143dc0c5829c5fc80cf3a0fc1b0e4
Author: Marvin Humphrey <[email protected]>
Date: 2015-05-09T02:04:07Z
Change test to subclass Obj rather than Hash.
Hash is about to become final, so we need to subclass a class which will
remain extensible: Obj.
commit 5bd1128544af1cf7111ae4d3bae774e959d2ec95
Author: Marvin Humphrey <[email protected]>
Date: 2015-05-09T02:05:31Z
Export OFFSET vars for `final` methods.
Without the export, symbol resolution fails during dynamic linking.
commit 9a71917c7fdcec8ea2a501b874308983197f8c37
Author: Marvin Humphrey <[email protected]>
Date: 2015-05-09T02:24:56Z
Export all _IMP symbols.
It is not sufficient to export only _IMP symbols for final methods,
because it's possible that a subclass final method be an alias for it.
commit 8304e2e22f53ce5febbcf863b489f9db23a9aafa
Author: Marvin Humphrey <[email protected]>
Date: 2015-05-09T02:27:49Z
Mark many core types as `final`.
Blob, ByteBuf, CharBuf, Class, Hash, HashIterator, Method, Integer32,
Integer64, Float32, Float64, Vector.
commit 9180666129b6b32f1795b283ccf96d943db3ffb7
Author: Marvin Humphrey <[email protected]>
Date: 2015-05-09T02:56:28Z
Custom XS ctors for final classes should use new.
Using `init` instead of `new` allows Perl-space subclassing, which is
inappropriate for final classes.
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---