Hacker News new | ask | show | jobs
by alexandernst 2215 days ago
Someone looking for the unbeatable https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpris... ?
1 comments

Seems unrelated. Does Java have a compile-time feature that is Turing complete and can be (ab)used to write FizzBuzz? For example, C++ has such a feature: https://gist.github.com/bgaff/2496338 (there's more examples, try searching for "accidentally Turing-complete", there are some really fun solutions.)
As far as i know, No. The compiler stubbornly refuse to inline any method calls.

But it has been proposed in JEP 303 [1]

[1] https://openjdk.java.net/jeps/303

Actually, subtype-checking in Java is Turing-complete. Someone proved this and used the result to build a parser generator for fluent interfaces. [1]

[1] https://arxiv.org/pdf/1605.05274.pdf

They are related in that they both implement FizzBuzz in a way that is highly unlikely to be ever used, nor recommended to be used.
The cases are related because in both implementations it is unlikely that a human computer reader ever halts.