Live data from Hacker News

Show HN: FizzBuzz purely in Rust's trait system

github.com

11–20 of 32 posts

Re: Show HN: FizzBuzz purely in Rust's trait system

#18
Fizz Buzz rules here: https://en.m.wikipedia.org/wiki/Fizz_buzz

Rules for actually using this crate: Don't :-).

That said, there are legitimate reasons to implement things at compile time. It means that libraries can create very efficient code that you don't have to write. But like all of powerful capabilities you should beware of misusing them. Like this :-).

Re: Show HN: FizzBuzz purely in Rust's trait system

#19
post #8

Someone looking for the unbeatable https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpris... ?

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

Re: Show HN: FizzBuzz purely in Rust's trait system

#20
post #8

Earlier quoted context omitted.

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

Post reply on HN