janino-compiler / janino

Janino is a super-small, super-fast Java™ compiler.
http://janino-compiler.github.io/janino
Other
1.21k stars 205 forks source link

Will Janino implement the features of generics and lambda expressions? #200

Closed aunkrig closed 1 year ago

aunkrig commented 1 year ago

(This question was sent to me via email on 2023-02-09.)

As the title said, I want to know whether the janino compiler will implement these features or stagnate at this stage. If you are implementing generics, I would like to know how it is progressing. Thank you.

aunkrig commented 1 year ago

Hey Janino user,

yes, the missing support for generics and lambdas is definitely a major limitation. I deliberated for years about whether I should add (at least) generics, and have even made attempts to see how they could be implemented.

The insight, however, is that generics are very difficult to model and implement, much more difficult than most people would think. They just use List<String>, and that's it. Most don't even use super and extends, or, if they are forced to, give up and fall back to type casts. In contrast, implementing generics in a Java compiler is nightmare of complexity, and would typically double the size of the compiler. No kidding.

So, wrt the paradigm that Janino should remain a "small" embedded compiler, and lack of resources, I have not implemented generics so far, and probably never will. Unless there are very good reasons to do so, e.g. sh**loads of money ;-).