News for hackers. Stuff that matters.

healeycodes

Re:Adding Go's Defer to the TypeScript Compiler on Monday August 03, 2026 @01:35AM (#49151588)
Cool! I kinda feel like these should be built-in. But this looks useful for closing the DX gap here.
Re:Adding Go's Defer to the TypeScript Compiler on Monday August 03, 2026 @01:31AM (#49151570)
Reasonably? Yes. Could probably be made to work well.

  $ bat 2.ts
  ───────────────
     1 │ function one() {
     2 │   let x = 1;
     3 │   defer (() => { throw new Error("thrown from one!"); })()
     4 │   x = 2;
     5 │ }
     6 │ one();
  ─────┴─────────

  $ node 2.js
  ~/healeycodes-typescript-go/2.js:29
            throw _errors_1[0];
            ^

  Error: thrown from one!
      at _callee_1 (/Users/andrew/Documents/GitHub/healeycodes-typescript-go/2.js:9:46)
      at /Users/andrew/Documents/GitHub/healeycodes-typescript-go/2.js:10:33
      at one (/Users/andrew/Documents/GitHub/healeycodes-typescript-go/2.js:22:31)
      at Object.<anonymous> (/Users/andrew/Documents/GitHub/healeycodes-typescript-go/2.js:34:1)
      at Module._compile (node:internal/modules/cjs/loader:1830:14)
      at Object..js (node:internal/modules/cjs/loader:1961:10)
      at Module.load (node:internal/modules/cjs/loader:1553:32)
      at Module._load (node:internal/modules/cjs/loader:1355:12)
      at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
      at Module.executeUserEntryPoint [as runMain (node:internal/modules/run_main:154:5)

  Node.js v24.15.0
Re:Adding Go's Defer to the TypeScript Compiler on Monday August 03, 2026 @01:21AM (#49151517)
Author here. I find try/finally verbose and vulnerable to mistakes. For me, it adds "function noise".
Re:A Tiny Compiler for Data-Parallel Kernels on Saturday June 27, 2026 @01:04AM (#48695306)
You're right that my post's algo does not handle this case (it's more of a toy to explain the basic cases).

> When I read Allan and Kennedy my impression was that vectorising arbitrary imperative code is a much harder problem than designing a language that only allows for vectorisable constructs to be expressed in the first place.

Yeah, I buy this.

> In my example that would produce different code, requiring a multiplication:

  lambda i: table[(phase0 + i*inc) % TABLE_LEN]
I think some compilers may lower this without the multiplication.. (e.g. turning it back into an induction variable) but with floats they may not be allowed to, since repeated addition and "phase0 + i*inc" are not strictly equal.
Re:Building a Shell on Tuesday March 17, 2026 @09:08AM (#47412143)
Editing the current line works because I brought in https://man7.org/linux/man-pages/man3/readline.3.html towards the end so I could support editing, tab completion, and history.

IIRC readline uses a `char *` internally since the length of a user-edited line is fairly bounded.

Re:Building a Shell on Tuesday March 17, 2026 @07:31AM (#47411255)
Author here, and yeah, I agree. I skipped writing a parser altogether and just split on whitespace and `|` so that I could get to the interesting bits.

For side-projects, I have to ask myself if I'm writing a parser, or if I'm building something else; e.g. for a toy programming language, it's way more fun to start with an AST and play around, and come back to the parser if you really fall in love with it.

Re:Counting Words at SIMD Speed on Sunday August 17, 2025 @03:18AM (#44929584)
Author here, one of the fastest improvements I've seen is @cloud11665's idea here: https://x.com/cloud11665/status/1955958965046595699

Show HN: Queuedle – Daily word-sliding puzzle inspired by Wordle and Scrabble

https://queuedle.com

Hey HN!Queuedle is a daily word-sliding puzzle that I play with my friends. It combines the positional gameplay of Scrabble with the daily puzzle and discovery elements of Wordle.The letter distribution mirrors Scrabble's tile frequencies, and daily puzzles are generated deterministically using the current date as a seed. It uses the Scrabble (TWL06-US) word list, but excludes two-letter...

( Read More... | no comments | on HN )
Re:Show HN: Lisp in C# on Tuesday July 23, 2024 @05:07AM (#41044108)
You can annotate the code blocks in the README to get generic lisp syntax highlighting.

```lisp

(+ 1 2)

```

Re:Making Python Less Random on Friday July 12, 2024 @05:08AM (#40943924)
Yes, it works on any process that makes a SYS_getrandom call.

Older »