Proxying final classes should be possible after all

18 views
Skip to first unread message

Jakub Holý

unread,
Oct 6, 2015, 4:04:32 PM10/6/15
to core.typed
The Ambrose's StrangeLoop talk mentions as one of the main challenges on the way towards gradual typing inability to wrap (i.e. proxy) final classes, f.ex. those produced by deftype. It is true that final classes cannot be extended but frameworks such as Mockito have been circumventing this through the use of bytecode manipulation for quite some time so I assume that Typed Clojure should be able to do the same thing, or am I missing something?

And how often is this a problem anyway? If we only use functions or protocols without deftype, is that easy to proxy? So is it only a problem with deftype and perhaps final Java classes used from Typed Clojure (but these are Java-typed so we perhaps do not need to check them thoroughly at runtime?)

Cheers,

Jakub Holy

Ambrose Bonnaire-Sergeant

unread,
Oct 6, 2015, 5:57:10 PM10/6/15
to core.typed
I don't know how to redefine a class without breaking instance? checks with existing instances. I want to avoid this.

Otherwise you end up with the dreaded "Foo is not an instance of Foo".

Thanks,
Ambrose
Reply all
Reply to author
Forward
0 new messages