News for hackers. Stuff that matters.
Re:I've just learned Rust and I think I'm in love by hprotagonist on Friday March 30, 2018 @12:50PM (#16717704)
Not only that, any code examples in rustdoc are treated like tests and get executed during compilation! That ensures that your examples are not obsolete (or at least that they compile).

That is a genuinely great idea.

Re:I've just learned Rust and I think I'm in love by iampims on Friday March 30, 2018 @01:21PM (#16717976)
I believe it's also how it works in go documentation. Examples are executed at compile time.
Re:I've just learned Rust and I think I'm in love by yangmaster on Saturday March 31, 2018 @12:16AM (#16721692)
It's also present in Elixir!
Re:I've just learned Rust and I think I'm in love by _ZeD_ on Friday March 30, 2018 @01:13PM (#16717896)
It's present in python too
Re:I've just learned Rust and I think I'm in love by seangransee on Friday March 30, 2018 @02:02PM (#16718382)
Didn't realize this was possible with Sphinx (Python) until I saw your comment and did some digging. Here's the relevant documentation if anyone else is curious:

http://docs.sphinxdocs.com/en/latest/step-3.html#step-3-keep...

Re:I've just learned Rust and I think I'm in love by hprotagonist on Friday March 30, 2018 @01:15PM (#16717913)
but as usual, it's optional.
Re:I've just learned Rust and I think I'm in love by agumonkey on Friday March 30, 2018 @01:17PM (#16717937)
such is life, especially in dynlangs, things got added, it's already cool that it's known and works finely as it is.

maybe one day domains, limits and code/proofs will be a single entity in source

Re:I've just learned Rust and I think I'm in love by staticassertion on Friday March 30, 2018 @01:59PM (#16718337)
Not without external tooling, as far as I'm aware.

With rust this is built into the default tools installed by rustup.

Re:I've just learned Rust and I think I'm in love by Macha on Friday March 30, 2018 @02:07PM (#16718428)
?

> https://docs.python.org/2/library/doctest.html

Write doctests in your docstrings, run python -m doctest

Re:I've just learned Rust and I think I'm in love by staticassertion on Friday March 30, 2018 @02:45PM (#16718733)
Sweet. Thank you.
Re:I've just learned Rust and I think I'm in love by weberc2 on Friday March 30, 2018 @05:51PM (#16720080)
Go does this as well.
Re:I've just learned Rust and I think I'm in love by maxxxxx on Friday March 30, 2018 @01:26PM (#16718016)
Wow, that's very nice!