Live data from Hacker News

Show HN: FizzBuzz purely in Rust's trait system

github.com

1–10 of 32 posts

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

#5

On the "clunky syntax" doc comment: a thing typenum does repeatedly is to define generic typedefs that become trait exprs. For example, type If = >::Output;

I was unaware of typenum until I started showing people this - I'm actually amazed at the level of effort that's gone into it.

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

#7
Beautiful. With such advances on the frontier of Trait exploitation, soon most of the Rust language will become obsolete and everything will be evaluated on compile-time! It is the ultimate optimization. Just embed the most expected output values in the binary and run time calculation becomes redundant.

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

#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.)

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

#9
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.)

The cases are related because in both implementations it is unlikely that a human computer reader ever halts.

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

#10
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.)

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.
Post reply on HN