frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

I was wrong about TypeScript part 1

https://chefama.blog/blog/posts/i-was-wrong-about-typescript-1
19•todsacerdoti•4d ago

Comments

hutao•1h ago
> TypeScript’s type system is purely structural and exists only at compile time. It has no way to verify that your function actually implements what its signature claims. You can declare that a function transforms a User into a SafeUser, and as long as the return object has the required fields of SafeUser, TypeScript doesn’t care what additional properties might still be lurking in there.

> This is fundamentally different from languages like Rust, where the type system can actually guarantee that if you claim to return an Option<T>, you genuinely can’t return null, the compiler enforces the contract at the language level. Rust’s type system doesn’t just trust your annotations; it verifies them.

This design where types are present at compile-time but disappear at runtime is called type erasure, and it's extremely common. For example, Java's generics are type erased. If you have some Java class Foo<T, U>, in the bytecode it will simply become Foo, and T and U will become Object. Therefore, you cannot use runtime introspection to recover their instantiations.

The remark contrasting TypeScript to Rust seems a little confused. Rust also uses type erasure; types and lifetimes are checked by the compiler, then the compiler produces a native executable, which is just machine code and would not contain type information. Option<&T> could be treated as a pointer T*, because the niche optimization ensures that the Option::None variant is represented as 0 or NULL. If C code were to interact with Rust code via FFI, it would be able to pass a value of 0. However, Rust doesn't have a null value the way that it's commonly understood in languages such as Java, C#, or JavaScript, a distinguished value that denotes a "sentinel" reference that does not refer to any object. I would say that the null reference is semantically a higher-level concept, specific to these particular programming languages.

Philosophically, the notion of type erasure goes all the way back to Curry-style (extrinsic) typing, which is contrasted with Church-style (intrinsic) typing. For example, in Curry-style typing, the program (fun x -> x) is the identity function on all types, while in Church-style typing, each type A has its own identity function, (fun (x : A) -> x) and a program is meaningless without types.

Please correct me if I'm wrong or misunderstood!

catlifeonmars•5m ago
[delayed]

Happy Public Domain Day 2026

https://publicdomainreview.org/blog/2026/01/public-domain-day-2026/
128•apetresc•3h ago•14 comments

Why users cannot create Issues directly

https://github.com/ghostty-org/ghostty/issues/3558
91•xpe•3h ago•34 comments

A website to destroy all websites

https://henry.codes/writing/a-website-to-destroy-all-websites/
422•g0xA52A2A•8h ago•244 comments

Marmot – A distributed SQLite server with MySQL wire compatible interface

https://github.com/maxpert/marmot
37•zX41ZdbW•2h ago•6 comments

Can Bundler be as fast as uv?

https://tenderlovemaking.com/2025/12/29/can-bundler-be-as-fast-as-uv/
193•ibobev•7h ago•64 comments

Cameras and Lenses (2020)

https://ciechanow.ski/cameras-and-lenses/
381•sebg•11h ago•46 comments

Show HN: Enroll, a tool to reverse-engineer servers into Ansible config mgmt

https://enroll.sh
99•_mig5•1d ago•22 comments

James Moylan, engineer behind arrow signaling which side to refuel a car, dies

https://fordauthority.com/2025/12/ford-engineer-that-designed-gas-tank-indicator-passes-away/
14•NaOH•6d ago•2 comments

Linux is good now

https://www.pcgamer.com/software/linux/im-brave-enough-to-say-it-linux-is-good-now-and-if-you-wan...
576•Vinnl•8h ago•497 comments

Extensibility: The "100% Lisp" Fallacy

https://kyo.iroiro.party/en/posts/100-percent-lisp/
21•todsacerdoti•3h ago•4 comments

WebAssembly as a Python Extension Platform

https://nullprogram.com/blog/2026/01/01/
58•ArmageddonIt•6h ago•1 comments

Show HN: OpenWorkers – Self-hosted Cloudflare workers in Rust

https://openworkers.com/introducing-openworkers
393•max_lt•13h ago•117 comments

BYD Sells 4.6M Vehicles in 2025, Meets Revised Sales Goal

https://www.bloomberg.com/news/articles/2026-01-01/byd-sells-4-6-million-vehicles-in-2025-meets-r...
202•toomuchtodo•12h ago•318 comments

2025 Letter

https://danwang.co/2025-letter/
285•Amorymeltzer•14h ago•185 comments

Dell's version of the DGX Spark fixes pain points

https://www.jeffgeerling.com/blog/2025/dells-version-dgx-spark-fixes-pain-points
114•thomasjb•9h ago•60 comments

Python numbers every programmer should know

https://mkennedy.codes/posts/python-numbers-every-programmer-should-know/
307•WoodenChair•14h ago•137 comments

Bluetooth Headphone Jacking: A Key to Your Phone [video]

https://media.ccc.de/v/39c3-bluetooth-headphone-jacking-a-key-to-your-phone
447•AndrewDucker•17h ago•166 comments

Finland detains ship and its crew after critical undersea cable damaged

https://www.cnn.com/2025/12/31/europe/finland-estonia-undersea-cable-ship-detained-intl
353•wslh•10h ago•318 comments

50% of U.S. vinyl buyers don't own a record player

https://lightcapai.medium.com/the-great-return-from-digital-abundance-to-analog-meaning-cfda9e428752
149•ResisBey•13h ago•162 comments

I was wrong about TypeScript part 1

https://chefama.blog/blog/posts/i-was-wrong-about-typescript-1
19•todsacerdoti•4d ago•1 comments

Gaming on a Receipt Printer [video]

https://www.youtube.com/watch?v=oEqvYXYI56s
10•zdw•5d ago•1 comments

Quickemu: Quickly create and run optimised Windows, macOS and Linux VMs

https://github.com/quickemu-project/quickemu
128•teekert•2d ago•28 comments

I rebooted my social life

https://takes.jamesomalley.co.uk/p/this-might-be-oversharing
363•edent•17h ago•290 comments

Moving Images Related to the Apollo Missions, 1967–1969

https://catalog.archives.gov/id/133360601
41•handfuloflight•1w ago•5 comments

Straussian Memes

https://www.lesswrong.com/posts/CAwnnKoFdcQucq4hG/straussian-memes-a-lens-on-techniques-for-mass-...
28•kp1197•7h ago•34 comments

C-events, yet another event loop, simpler, smaller, faster, safer

https://zelang-dev.github.io/c-events/
66•thetechstech•6d ago•11 comments

If you care about security you might want to move the iPhone Camera app

https://blog.jgc.org/2025/12/if-you-care-about-security-you-might.html
170•jgrahamc•4d ago•80 comments

All my Deutschlandtickets gone: Fraud at an industrial scale [video]

https://media.ccc.de/v/39c3-all-my-deutschlandtickets-gone-fraud-at-an-industrial-scale
107•Kyro38•4d ago•49 comments

Building an internal agent: Code-driven vs. LLM-driven workflows

https://lethain.com/agents-coordinators/
57•pavel_lishin•10h ago•25 comments

Why Prefer Textfiles? (2010)

http://textfiles.com/uploads/textfiles.txt
20•kmstout•5h ago•22 comments