Live data from Hacker News

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

github.com

21–30 of 44 posts

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

#25

At that point, why not just use another jvm language with these features like Kotlin?

Ever tried to "sell" an alternative language in BigCo Enterprise? Where I work, Javascript is still a front-end only language and just tolerated as a toolchain for compiling LESS, ECMAScript etc.

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

#26

At that point, why not just use another jvm language with these features like Kotlin?

Scott McKinney, the guy behind that library, is also the guy behind Gosu [1].

Selling a new language is hard, selling a library is easier, even if this one has a hook deep in the code of javac.

[1] https://en.wikipedia.org/wiki/Gosu_(programming_language)

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

#27
Wow, this looks like a god-send. The @Jailbreak annotation would give mid-2000's Java coders a heart-attack :)

The only contentious point I find is that they are basically replicating Project Lombok's @SneakyThrows annotation via "Xplugin:Manifold stringsexceptions" or ModelMapper in their Structural Typing.

Furthermore it seems it should be structured in sub-projects, eg. the String-templates and ManTL in one lib, Structural Typing in another so we can mix & match.

But overall, very impressive!

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

#28
post #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.

It should not be optional :)

Checked exceptions is a stupid feature because it makes an implementation detail, the fact that a code raises an exception, part of the type of a method.

Scala, C# or Kotlin have no checked exception and it doesn't make them less safe.

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

#30
post #11
post #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??

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…

How much of an update hazard is this? Does it break with every major java upgrade?
Post reply on HN