It's such a tiny thing, but I really like the Python or Lisp convention of putting the doc string inside the definition.
I find I write the signature first anyway, and figure out what I want to call my function, before I know how I want to describe it.
miniblog.
Related Posts
TIL that PGP keyservers no longer support 'web of trust' chains of signatures, as they were being spammed by people uploading massive signature chains:
Anecdotally, I've noticed more frequent doc comments in languages that put them inside the function (e.g. Python, Lisp) rather than outside (JS, Rust).
Perhaps it's easier to write the rough signature before the explanation?
I refactored some Rust string splitting logic:
old: &[&str] -> Vec<String>
new: &[&str] -> Vec<&str>
It's a little faster, but it's an interesting type signature. You can figure out more of how the new one works! It must be slicing into the input string.
