Acidica

Ned Batchelder · 2026年7月26日

AI 摘要 AI 生成,可能有误

作者介绍了 Acidica,这是他们利用一周假期开发的业余 BASIC 解释器项目,基于 Vintage BASIC 规范,部分动机来自对早期计算时代的怀旧。作者反思了 BASIC 原始设计中的种种怪癖、自己宽松的开发选择(仅做集成测试、不使用 AI、极少的类型检查),以及在没有截止期限的情况下工作的乐趣。未来可能的步骤包括将该项目用作开发想法的试验场、添加一个 BASIC 转 Python 的转换器,或者干脆就此视为完成。

My latest fun project is a BASIC interpreter called Acidica. Classic BASIC is an old-school language first developed in 1964 that saw an explosion of implementations on microcomputers in the ‘70s and ‘80s. It’s much more primitive than the Visual Basic that you might be familiar with.

A simple BASIC program:

10 INPUT "What is your name"; U$

20 PRINT "Hello "; U$
30 INPUT "How many stars do you want"; N
40 S$ = ""
50 FOR I = 1 TO N
60 S$ = S$ + "*"
70 NEXT I
80 PRINT S$
90 INPUT "Do you want more stars"; A$
100 IF LEN(A$) = 0 THEN 90
110 A$ = LEFT$(A$, 1)
120 IF A$ = "Y" OR A$ = "y" THEN 30
130 PRINT "Goodbye ";U$
140 END
继续阅读全文

为了尊重作者,这里只展示开头几段。你可以去原文阅读,或者在 HorizonReader 里读:划线做笔记、让 AI 帮忙。

更多来自 Ned Batchelder

Human sorting, hardened

AI 摘要The article describes fixing a long-tail bug in the author's 'human sorting' function, where file names containing numeric runs longer than Python's 4300-digit int conversion limit (added in 2022 to prevent denial-of-service attacks) caused a TypeError because ValueError was misinterpreted as 'not a number.' The fix converts only the digit parts identified by re.split, returning float('inf') for over-long digit runs, while noting that isdigit()-based approaches fail due to Unicode discrepancies with the \d regex. A later update presents Jeff Epler's cleverer alternatives, including parsing digit runs as base 16 (which has no length limit and sorts identically) or using (length, value) tuples, though the author hasn't benchmarked them.

Cupcake party

AI 摘要To celebrate Nat's 37th birthday, the family hosted a cupcake-baking party at his group home, bringing box mixes, sugar-free options for his diabetic housemate, and decorating supplies so all the housemates could join in. Everyone wore aprons and chef's hats, helped mix and bake, and decorated cupcakes—surprisingly all choosing vanilla icing—though the family forgot candles and singing 'Happy Birthday.' Reflecting on the day, the author expresses gratitude that Nat has found a warm living situation where the housemates feel like family and the staff like friends.

Evergreen posts

AI 摘要The author describes blog features they built: since old technical posts may contain outdated details, posts older than five years automatically display human-style age descriptions like 'nearly 12 years' followed by a 'Be careful' warning. Posts that never go stale can be marked 'evergreen,' replacing the warning with 'but it's still good,' which the author recently made customizable per post. They conclude that owning their own site lets them create small, seemingly pointless features that bring them joy.

Making git hooks visible

AI 摘要Inspired by an attack where a Dropbox-shared git checkout carried active malicious hooks, the author built zsh chpwd functions to make git hooks visible when entering a repo. The first function announces any executable, non-sample hooks in a repo's hooks directory (once per repo to avoid noise), and a second warns when a .pre-commit-config.yaml exists but the pre-commit hook isn't installed. Together with a startup check for the initial directory, these functions keep the author aware of active hooks and caught at least one project where pre-commit had been forgotten.

Expert asterisks

AI 摘要The article describes the 'Expert Asterisk,' a common pattern in online help discussions where experts assisting beginners add obscure, rarely-used details and tangents that distract learners from their original questions. Using a git help exchange as an example, the author shows how such additions—while well-intentioned and potentially useful to advanced users—can derail a novice who lacks the context to sift important information from esoteric footnotes. The author advises experts to resist the urge to add tangents, instead focusing on understanding the beginner's actual situation and mindset so their help can truly be heard.