miniblog.

26
Assertions are a surprisingly nuanced design space. In a test, if I assert `x < y`, I really want to see the values of x and y when it fails. Do you define an API for every possible predicate (Python's assertLess, expect.js) or try to support the native syntax (c.f. pytest)?
49
It's odd that games often show the hours played, but I've not seen this in other apps. "You've spent 20 hours talking to this person." Would this be a usage deterrent? If so, why do many games offer it by default?
144
I'm intrigued to see that Google has quantified that new code is generally buggier and less secure than code that has existed in your codebase for longer:
JSON is too small (no comments) and YAML is too big (many string syntaxes, relatively few implementations). TOML is in the sweet spot for complexity, but I agree this syntax is by far the most confusing part. TOML 1.1 improves it at least:
57
C++ no longer considers trivial infinite loops to be undefined behaviour! https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2809r3.html Spotted in the release notes for the latest clang.
4
ASTs typically discard comments, and that's usually what you want. The only time (AFAICS) that preserving comments is useful is for writing a code formatter. Could you write a formatter in terms of a list of lexemes? A CST is a non-trivial bit of code for one use case.
I'm not a fan of the mastodon web UI behaviour where moving down with cursor keys 'snaps' to the next toot. Is it possible to disable this, so my cursor keys always move the page by a consistent visual amount? I've poked in the settings and didn't see anything obvious.
... and my third refactoring with Cursor changed some function calls that I didn't want it to modify. Subtle. I've had the most success with AI coding tools when I know exactly what I want the output to look like.
I'm pretty impressed with Cursor: I've successfully asked it to perform codebase transforms in English, and it's worked! E.g. "Replace all calls foo(..., true) with foo_immediate(...) define a foo_immediate function". I'm still reading the diff and checking tests -- it's still AI after all.
An ad hoc, informally-specified, bug-ridden, slow implementation of half of a text adventure game -- or as I like to call it, a compiler.
TIL Rust has an ambiguity `if Foo {}` -- is `Foo` a value of type bool, or a struct? Rust solves this by defining a grammar production 'any expression except struct literals' and using it in this position.
It's so strange that we talk about languages being slow, and have done for years. Computer performance has increased so much in this time. https://hbfs.wordpress.com/2009/11/10/is-python-slow/ (shared on HN in 2009) discusses Python being slow. My underpowered Thinkpad has 20x the single-threaded performance! https://www.cpubenchmark.net/compare/73vs3766/AMD-Athlon-64-4000+-vs-AMD-Ryzen-5-PRO-4650U Maybe *relative* performance of languages matters more?
I like that most LLM UIs show your previous queries prominently. When figuring out where LLMs are useful in your workflow, it's nice to see what worked well (or not) in the past. Web search doesn't have this property. I rarely look at what I've previously googled.
I'm a fan of the Software Unscripted podcast, and I particularly enjoyed this recent episode about CrowdStrike and security culture: https://www.youtube.com/watch?v=rzjaZssBEiI The guest (Kelly Shortridge) compares attackers to lawyers trying to find loopholes. This is such a great analogy.
One interesting design choice in Emacs that I haven't seen in other editors: reserved shortcuts. An Emacs extension shouldn't use F5 through F12, or Ctrl-c LETTER. This lets users configure their own shortcuts. https://www.gnu.org/software/emacs/manual/html_node/emacs/Key-Bindings.html Does it exist elsewhere? I miss it in VS Code, where e.g. all the Fn keys are already assigned.
Showing 31-45 of 138 posts