Thanks for the pointer. Dynalink does indeed look like the right tool,
albeit quite a lot of work for a small project. Maybe I'll experiment if I
have time. I wonder if you've looked at a way to integrate Dynalink with
Graal/Truffle as it seems they have quite similar concepts of a high level
object model with get/set "messages" etc. It'd be nice if the two
mechanisms were compatible.
"Expando" is Internet Explorer terminology for a natively implemented
object that has extra properties set on it from JS. I think to implement
expandos with this scheme, I'd need to write a custom linker that maintains
an IdentityHashMap<Object, HashMap<String, Object>> and then catches the
right exception in handling property sets from the next linker in the
chain. If the bean linker can't handle the set because there's no such
property, I'd insert the property into the hashmaps. I'd also check those
first before delegating to the bean linker when handling gets. That could
be quite some fancy method handle logic!
On Mon, Mar 19, 2018 at 23:52:44, Sundararajan Athijegannathan<
Haven't gone through the referred code. Do you want to add more properties
to a Java object apart from "bean properties" inferred?
If so, you can write your own dynalink linker with jdk9.
Hope this helps,
Thanks for writing Nashorn, it's useful!
I'm trying to run https://github.com/domchristie/turndown in Nashorn,
using JSoup to provide a simple DOM, but have hit an issue because Turndown
expects to be able to add its own properties to DOM objects. This is
something browsers support but Nashorn doesn't. I do realise that Nashorn's
approach is allowed by the specs, but I'm wondering if there's any way to
hack things up such that the library can do what it wants. I can also just
change the code, but I'm curious if there's a quick fix here.