Live data from Hacker News

Manifold: Java Type-Safe Metaprogramming, Structural Typing, Extension Methods

github.com

1–10 of 44 posts

Re: Manifold: Java Type-Safe Metaprogramming, Structural Typing, Extension Methods

#2
Manifold is an amazing piece of engineering. Scott McKinney, the author, used to work on Gosu but mostly focuses on this now.

He added GraphQL support a few weeks ago:

https://github.com/manifold-systems/manifold-sample-graphql-...

You can just drop graphql files in your resources directory and start coding against them as type-safe interfaces immediately, no code-gen required.

The @Jailbreak annotation is awesome too.

Re: Manifold: Java Type-Safe Metaprogramming, Structural Typing, Extension Methods

#3

Manifold is an amazing piece of engineering. Scott McKinney, the author, used to work on Gosu but mostly focuses on this now. He added GraphQL support a few weeks ago: https://github.com/manifold-systems/manifold-sample-graphql-... You can just drop graphql files in your resources directory and start coding against them as type-safe interfaces immediately, no code-gen required. The @Jailbreak annotation is awesome to…

Looks pretty cool. Reminds me a lot of the ways in which Groovy improves Java.

Re: Manifold: Java Type-Safe Metaprogramming, Structural Typing, Extension Methods

#6

At 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

#8
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??

Re: Manifold: Java Type-Safe Metaprogramming, Structural Typing, Extension Methods

#9
post #5

Removing checked exceptions - what a dangerous feature!

It's optional. It seems scary, but checked exceptions are a feature exclusive to the Java compiler -- the JVM does not enforce them. This is how JVM languages like Kotlin and others only use unchecked exceptions, and also how Manifold gets away with muting them as a compile-time feature.

Re: Manifold: Java Type-Safe Metaprogramming, Structural Typing, Extension Methods

#10
post #7

This 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 ;)
Post reply on HN