News for hackers. Stuff that matters.
Re:Please do not attempt to simplify this code by runevault on Tuesday August 06, 2024 @07:53PM (#41176793)
Note in Rust if you include comments with code that will run as tests but be inline in your main code instead of having to find the relevant test function to confirm functionality.

https://doc.rust-lang.org/rustdoc/write-documentation/docume...

Re:Please do not attempt to simplify this code by rob74 on Wednesday August 07, 2024 @03:00AM (#41178883)
Go has something similar: functions marked as examples that are both run as tests and shown and run as examples in the documentation (https://go.dev/blog/examples)
Re:Please do not attempt to simplify this code by runevault on Wednesday August 07, 2024 @03:13AM (#41178948)
Interesting. I don't know when that was implemented in Rust but clearly Go has had it for a long time, since that post is dated 2015.

While things like syntax are important, languages adding tooling like this (along with stuff like package managers) is so important to the continued evolution of the craft of software development.