I thought I knew all about Java, but this thing makes me feel like I haven't got a clue! How can it achieve this stuff by just being in the classpath?? No Java agent can be involved, no codegen during the build?! This shouldn't be possible, or??
Manifold: Java Type-Safe Metaprogramming, Structural Typing, Extension Methods
11–20 of 44 posts
Re: Manifold: Java Type-Safe Metaprogramming, Structural Typing, Extension Methods
#12I thought I knew all about Java, but this thing makes me feel like I haven't got a clue! How can it achieve this stuff by just being in the classpath?? No Java agent can be involved, no codegen during the build?! This shouldn't be possible, or??
Probably the most interesting aspect of Manifold is its role as a type name resolver for the compiler. Manifold provides an API to dynamically resolve types corresponding with, well anything, but mostly with resources like JSON files, GraphQL schemas, SQL, DDL, CSV, scripting languages, you name it. So from the compiler's perspective it has no idea what is going on beyond normal type name resolution, but the source files it's loading up are coming from deep, dark places ;)
But yeah, no code generation step in your build, no agents, no custom class loaders, etc.
Re: Manifold: Java Type-Safe Metaprogramming, Structural Typing, Extension Methods
#13I thought I knew all about Java, but this thing makes me feel like I haven't got a clue! How can it achieve this stuff by just being in the classpath?? No Java agent can be involved, no codegen during the build?! This shouldn't be possible, or??
Ok just checked this deeper. The [docs]( http://manifold.systems/docs.html ) actually show this is a javac plugin (I didn't know about the `-Xplugin` flag, but you ALSO need to pass that to javac for Manifold to work)... you also need the `tools.jar` file (which includes the JavaCompiler) on the runtime classpath... so suddenly, there's no magic... it's a bit misleading to say this does not require a build step, it c…
Re: Manifold: Java Type-Safe Metaprogramming, Structural Typing, Extension Methods
#14I thought I knew all about Java, but this thing makes me feel like I haven't got a clue! How can it achieve this stuff by just being in the classpath?? No Java agent can be involved, no codegen during the build?! This shouldn't be possible, or??
Ok just checked this deeper. The [docs]( http://manifold.systems/docs.html ) actually show this is a javac plugin (I didn't know about the `-Xplugin` flag, but you ALSO need to pass that to javac for Manifold to work)... you also need the `tools.jar` file (which includes the JavaCompiler) on the runtime classpath... so suddenly, there's no magic... it's a bit misleading to say this does not require a build step, it c…
Re: Manifold: Java Type-Safe Metaprogramming, Structural Typing, Extension Methods
#15Re: Manifold: Java Type-Safe Metaprogramming, Structural Typing, Extension Methods
#16Earlier quoted context omitted.
Ok just checked this deeper. The [docs]( http://manifold.systems/docs.html ) actually show this is a javac plugin (I didn't know about the `-Xplugin` flag, but you ALSO need to pass that to javac for Manifold to work)... you also need the `tools.jar` file (which includes the JavaCompiler) on the runtime classpath... so suddenly, there's no magic... it's a bit misleading to say this does not require a build step, it c…
There's a significant difference between a code gen build step and what Manifold is doing with javac. Resource files are virtual source files, this represents a leap in terms of dev productivity.
Re: Manifold: Java Type-Safe Metaprogramming, Structural Typing, Extension Methods
#17This is what I wanted all my life! I wonder what kind of dark magic makes this go and how this will come back to bite me if I use it?
Manifold hooks into the Java compiler via the javac plugin API. This is similar to the way annotation processors work, but without the overhead of additional passes (or rounds) in the compiler. The plugin route also provides access to earlier stages of the compiler, for example this is how Manifold's string interpolation feature works. The overall details are a bit deep and dark for a comment, however ;)
Re: Manifold: Java Type-Safe Metaprogramming, Structural Typing, Extension Methods
#18At that point, why not just use another jvm language with these features like Kotlin?
the main feature of this allows you to transparently use structured data as types in your code like type providers in .net. I love kotlin but it can't do anything remotely like that.
Re: Manifold: Java Type-Safe Metaprogramming, Structural Typing, Extension Methods
#19Earlier quoted context omitted.
There's a significant difference between a code gen build step and what Manifold is doing with javac. Resource files are virtual source files, this represents a leap in terms of dev productivity.
Yes, I agree... just wished they made it clearer how they achieve that!
Re: Manifold: Java Type-Safe Metaprogramming, Structural Typing, Extension Methods
#20At that point, why not just use another jvm language with these features like Kotlin?