JiSE icon indicating copy to clipboard operation
JiSE copied to clipboard

Inheritance example with Abstract classes

Open zcaudate opened this issue 4 years ago • 4 comments

One problem that I've always faced with clojure is that it's not possible to derive things from Abstract classes.

https://stackoverflow.com/questions/53090419/clojure-proxy-implementing-abstract-class-with-protected-constructor

Can you create an example showing how to do it with JiSE?

zcaudate avatar Jun 23 '20 03:06 zcaudate

I will prepare some documentation on the JiSE syntax in the future, but shortly: You can use the optional "inheritance vector" syntax to specify the parent class and/or implemented interfaces. For example, if you want to define a class that is derived from the class P and implements the interfaces I1 and I2, you can write something like the following:

(require '[jise.core :refer [defclass]])

(defclass C [P I1 I2] ...)

athos avatar Jun 23 '20 13:06 athos

This is an example that I ran into trouble porting

https://github.com/orbit-legacy/orbit1

Another thing that is difficult is with annotations. I think orbit uses them well but it's not that well supported with clojure.

https://picocli.info/#_options_and_parameters

zcaudate avatar Jun 23 '20 14:06 zcaudate

Another interesting use case might be this:

http://teavm.org/docs/runtime/metaprogramming.html

zcaudate avatar Jun 23 '20 15:06 zcaudate

This would be another project that'd be great to get working:

https://github.com/bytedeco/javacpp

zcaudate avatar Jun 23 '20 18:06 zcaudate