Difftastic 0.30 is out! In this release:
* Added support for both Julia and HTML
* Better Unicode support
* Substantially improved dumb textual diffing performance too!
miniblog.
Compile times of 30-60 seconds are particularly challenging: they're too short to do something else, but too long to get into a flow state.
I find music helps avoid context switching at least.
When adding a new language to difftastic, it's hard to find interesting git repositories to test against.
I've started just querying GitHub for the most starred repos for a given language. For example, here's Haskell: https://github.com/search?l=&o=desc&q=stars%3A%3E500+language%3AHaskell&s=stars&type=Repositories
I've started playing again with A* search instead of Dijkstra for difftastic. So far it's only saved me visiting 3% of graph nodes, which is negligible.
A* works best when you have a good heuristic, but finding a good heuristic is hard. Currently:
Framing documentation work as creative solving of problems, not just writing up stuff made by other people:
Using a Box<str> in Rust: https://mahdi.blog/rust-box-str-vs-string/
(Unlike String, it isn't resizable, so it doesn't need to store capacity. Box<str> is only two words, unlike the three words in String!)
TIL that C++03 considered a file without a trailing newline to be undefined behaviour! https://stackoverflow.com/a/72377
This was fixed in C++11, but the problem was that #include was a textual operation that could produce invalid syntax if no newline was present.
If I were coming up with a new syntax today, I'd be tempted to put a deliberate marker in it.
"In funkylang, you declare functions with `funk foo() {}`."
Choosing a syntax for a new programming language is hard. You want to be similar enough to an established language to avoid scaring off users.
You still want to be sufficiently novel to be recognisable. Which languages do this well?
The Rust docs include a surprisingly readable example of how `for` loops desugar into essentially a while loop with a pattern match:
An excellent review of the V language and the features it promotes: https://mawfig.github.io/2022/06/18/v-lang-in-2022.html
The code samples are a great example of how you do PL work: you learn about the intended semantics and try to write programs that are broken in interesting ways.
Programming is a team activity: the vast majority of projects have multiple contributors. Yet all the films I've seen show a solo programmer at a keyboard.
Have any movies got this right?
Proper tail calls were added to the JS standard, but most implementations don't provide it. V8 even built it then removed it!
The concern is worse developer experience. An opt-in syntax has been proposed (cf loop/recur in Clojure) but no consensus.
https://www.mgmarlow.com/words/2021-03-27-proper-tail-calls-js/
I find myself writing .iter().map(|x| ...).collect() really often in Rust. I'm wondering if I should write a helper method on Vec, but it seems less idiomatic.
Iterators compose, but they're less versatile (no indexing) and awkward to return from functions.
Many languages use docstrings rather than doc comments: it certainly makes extracting them easier. You just parse the code.
Could you go further and require all comments to be string literals? I'm struggling to think of many downsides.
Showing 721-735 of 7,549 posts


