implShow HN: FizzBuzz purely in Rust's trait system
21–30 of 32 posts
Re: Show HN: FizzBuzz purely in Rust's trait system
#22Makes me think of the time, many, many, many years go, when I was learning IBM 7090 assembly language (my introduction to computers). The macro assembler was powerful enough that I could check for primality at assembly time.
Re: Show HN: FizzBuzz purely in Rust's trait system
#23what's Three here?
https://github.com/doctorn/trait-eval/blob/master/src/lib.rs
Re: Show HN: FizzBuzz purely in Rust's trait system
#24You didn't need this, you didn't want this, but here we are.
Re: Show HN: FizzBuzz purely in Rust's trait system
#25Fizz 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
#26It's horrible, I love it! Interesting implementation of `If`, I had no idea the trait system could be... used ... to such extent.
A lot of this is fairly standard church encoding.
Re: Show HN: FizzBuzz purely in Rust's trait system
#27Oh good. We're reaching C++ levels of template metaprogramming.
Re: Show HN: FizzBuzz purely in Rust's trait system
#28Makes me think of the time, many, many, many years go, when I was learning IBM 7090 assembly language (my introduction to computers). The macro assembler was powerful enough that I could check for primality at assembly time.
This sounds super awesome! I can't imagine how interesting those times might have been. I started to play around with a 6502 just because there is the possibility to understand the system to some extend. Modern day software engineering is like sitting in the golden cage. Not because the the systems are inaccessible like mobile devices or Apple Computers – you can still get pretty far on Linux systems – but the main r…
Re: Show HN: FizzBuzz purely in Rust's trait system
#29Earlier quoted context omitted.
This sounds super awesome! I can't imagine how interesting those times might have been. I started to play around with a 6502 just because there is the possibility to understand the system to some extend. Modern day software engineering is like sitting in the golden cage. Not because the the systems are inaccessible like mobile devices or Apple Computers – you can still get pretty far on Linux systems – but the main r…
It's not that bad, check out the Serenity OS project (on Youtube).
Re: Show HN: FizzBuzz purely in Rust's trait system
#30Oh good. We're reaching C++ levels of template metaprogramming.
C++ allows expressing that more concisely though :p https://twitter.com/Cor3ntin/status/1264600096869691392
The goal isn't to be concise, I think the goal is literally to just do it in the trait system