Comments (3)
Implementing proxy-super
properly seems a bit hard. I couldn't figure out how to detect whether the code is in a context where it is usually legal to call the superclass or not.
I've implemented a horrible hack while we wait for competent people to puzzle that one out. https://github.com/owenRiddy/proxy-plus-minus implements a proxy-super+ by automatically exposing the superclass' methods to everyone and hoping that people behave responsibly and/or don't consider such an audacious scheme and only put proxy-super+
in sensible places. This implementation should avoid https://clojure.atlassian.net/browse/CLJ-2201 and be usable in situations where thread safety is important.
I won't ask for my work to be pulled into proxy-plus
because I consider my efforts an affront to good software engineering and live in hope that someone will think of a better way.
from proxy-plus.
That's clever. Definitely too much of a hack to pull it in though. I think doing this properly would ultimately require support from the Clojure compiler.
from proxy-plus.
I think doing this properly would ultimately require support from the Clojure compiler.
It'd be helpful. Although after spending 24 hours mulling I'm not sure even access to the compiler is enough to get to an elegant proxy-super+
so I'm not holding my breath.
We're up against a really awkward crack in the design. Clojure functions are independent of the object that represents the proxy - therefore any attempt to replicate the behaviour of Java's super
will lead to weirdness because at the technical level there has to be a mechanism for one object to reach out and call another object's shadowed methods. Any restrictions on that are arbitrary.
Seems to me we need new semantics of what is reasonably allowed access to superclass methods (only lexically in the proxy+
? functions 1 deep in the call stack? Functions in the same namespace as the call to proxy+
? On the thread between when a proxied method starts and ends executon? Everything, everywhere all at once?).
Case closed for the moment I suppose.
from proxy-plus.
Related Issues (11)
- Should use type hints to distinguish methods of same arity and different types HOT 1
- Release jar should not contain test class files
- Add support for clj-kondo HOT 4
- How can I use this with custom methods or clojure protocols? HOT 4
- Upgrade to latest (newer) asm library - support newer jdk's HOT 3
- Can't use classes generated from AOT HOT 5
- How to call a superclass method? HOT 1
- Tricky Edge Cases HOT 5
- Ergonomic Hints
- Multiple constructors with the same arity can cause reflection HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from proxy-plus.