frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Modern Node.js Patterns

https://kashw1n.com/blog/nodejs-2025/
402•eustoria•8h ago•182 comments

Writing a good design document

https://grantslatton.com/how-to-design-document
196•kiyanwang•7h ago•49 comments

Persona vectors: Monitoring and controlling character traits in language models

https://www.anthropic.com/research/persona-vectors
296•itchyjunk•10h ago•96 comments

So you want to parse a PDF?

https://eliot-jones.com/2025/8/pdf-parsing-xref
100•UglyToad•5h ago•52 comments

Typed languages are better suited for vibecoding

https://solmaz.io/typed-languages-are-better-suited-for-vibecoding
83•hosolmaz•3h ago•75 comments

If you're remote, ramble

https://stephango.com/ramblings
709•lawgimenez•17h ago•374 comments

Why doctors hate their computers (2018)

https://www.newyorker.com/magazine/2018/11/12/why-doctors-hate-their-computers
15•mitchbob•2h ago•14 comments

Life, Work, Death and the Peasant: Family Formation

https://acoup.blog/2025/08/01/collections-life-work-death-and-the-peasant-part-iiia-family-formation/
79•Khaine•1d ago•0 comments

Welcome to url.town, population 465

https://url.town/
111•plaguna•1d ago•22 comments

Efficiently Generating a Number in a Range (2018)

https://www.pcg-random.org/posts/bounded-rands.html
6•csense•1d ago•0 comments

Names are not type safety (2020)

https://lexi-lambda.github.io/blog/2020/11/01/names-are-not-type-safety/
27•azhenley•4h ago•22 comments

Learnable Programming (2012)

https://worrydream.com/LearnableProgramming/
16•kunzhi•4h ago•6 comments

Human speech may have a universal transmission rate (2019)

https://www.science.org/content/article/human-speech-may-have-universal-transmission-rate-39-bits-second
18•Bluestein•5h ago•15 comments

How Python grew from a language to a community

https://thenewstack.io/how-python-grew-from-a-language-to-a-community/
6•lumpa•10h ago•0 comments

"If you can rack it, you can run UniFi OS" Ubiquiti self-hosted UniFi OS release

https://deluisio.com/networking/unifi/2025/08/03/everything-you-need-to-know-about-unifi-os-server-before-you-waste-time-testing-it/
40•codydeluisio•6h ago•3 comments

A study of lights at night suggests dictators lie about economic growth (2022)

https://www.economist.com/graphic-detail/2022/09/29/a-study-of-lights-at-night-suggests-dictators-lie-about-economic-growth
99•mooreds•4h ago•34 comments

Shrinking freshwater availability increasing land contribution to sea level rise

https://news.asu.edu/20250725-environment-and-sustainability-new-global-study-shows-freshwater-disappearing-alarming
126•ornel•7h ago•47 comments

Poorest US workers hit hardest by slowing wage growth

https://www.ft.com/content/cfb77a53-fef8-4382-b102-c217e0aa4b25
44•hhs•2h ago•20 comments

2,500-year-old Siberian 'ice mummy' had intricate tattoos, imaging reveals

https://www.bbc.com/news/articles/c4gzx0zm68vo
190•dxs•3d ago•52 comments

This Old SGI: notes and memoirs on the Silicon Graphics 4D series (1996)

https://archive.irixnet.org/thisoldsgi/
71•exvi•12h ago•4 comments

Tokens are getting more expensive

https://ethanding.substack.com/p/ai-subscriptions-get-short-squeezed
237•admp•16h ago•170 comments

Twenty Eighth International Obfuscated C Code Contest

https://www.ioccc.org/2024/index.html
316•mdl_principle•23h ago•92 comments

Show HN: Schematra – Sinatra-inspired minimal web framework for Chicken Scheme

https://github.com/rolandoam/schematra
22•funkaster•2d ago•1 comments

System-Wide Safety Project

https://www.nasa.gov/directorates/armd/aosp/sws/
10•pieterk•1d ago•0 comments

Converge (YC S23) well-capitalized New York startup seeks product developers

https://www.runconverge.com/careers
1•thomashlvt•10h ago

How to make almost anything (2019)

https://fab.cba.mit.edu/classes/863.19/CBA/people/dsculley/index.html
156•teleforce•16h ago•22 comments

UN report finds UN reports are not widely read

https://www.reuters.com/world/un-report-finds-united-nations-reports-are-not-widely-read-2025-08-01/
257•anjneymidha•10h ago•105 comments

How to grow almost anything

https://howtogrowalmostanything.notion.site/htgaa25
59•car•4h ago•13 comments

CloudGazing

https://cloudgazing.online/
18•speckx•2d ago•0 comments

The Ski Rental Problem

https://lesves.github.io/articles/ski-rental/
61•skywalqer•4d ago•72 comments
Open in hackernews

Names are not type safety (2020)

https://lexi-lambda.github.io/blog/2020/11/01/names-are-not-type-safety/
27•azhenley•4h ago

Comments

nixpulvis•2h ago
In Rust I find myself gaining a good bit of type safety without losing ergonomics by wrapping types in a newtype then implementing Deref for them. At first it might seem like a waste, but it prevents accidentally passing the wrong type of thing to a function (e.g. a user UUID as a post UUID).
5pl1n73r•2h ago
My peers and I work on a language centered around "constructive data modeling" (first time I hear it called that). We implement integers, and indeed, things like non empty lists using algebraic data types, for example. You can both have a theory of values that doesn't rely on trapdoors like "int32" or "string", as well as encode invariants, as this article covers.

As I understand it, the primary purpose of newtypes is actually just to work around typeclass issues like in the examples mentioned at the end of the article. They are specifically designed to be zero cost, because you want to not pay when you work around the type class instance already being taken for the type you want to make an instance for. When you make an abstract data type by not exporting the data constructors, that can be done with or without newtype.

eru•1h ago
The alternative to newtypes is probably to go the same route as OCaml and have people explicitly bring their own instances for typeclasses, instead of allowing each type only one instance?

I think OCaml calls these things modules or so. But the concepts are similar. For most cases, when there's one obvious instance that you want, having Haskell pick the instance is less of a hassle.

kazinator•2h ago
What if I want a type called MinusIntMaxToPlusIntMax?

In other words the full range of Int?

Is newtype still bad?

In other words how much of this criticism has to do with newtype not providing sub-ranging for enumerable types?

It seems that it could be extended to do that.

lmm•2h ago
IME this is exactly backwards: type safety is mostly about names, everything else is a nice-to-have. Yes, you can bypass your name checks if you want to, but you can bypass any type check if you want to. Most relevant type relationships in most programming are business relationships that would be prohibitively expensive to express in a full formalism if that was even possible. But putting names on them is cheap, easy, and effective. The biggest win from typed languages comes from using these basic techniques.
b_e_n_t_o_n•1h ago
Hmm, IME the preferred type systems are structural - a function shouldn't care what the name is of the struct passed to it, it should just work if it has the correct fields.
stirfish•54m ago
> should just work if it has the correct fields.

Correct fields by...name? By structure? I'm trying to understand.

b_e_n_t_o_n•48m ago
By name, type, and structure. In typescript for example:

   let full_name = (in: { first: string, last: string }) => in.first + " " + in.last
Then you can use this function on any data type that satisfies that signature, regardless of if it's User, Dog, Manager etc.
o11c•53m ago
The critical problem with structural typing is that it requires weird and arbitrary branding when dealing with unions of singletons.
b_e_n_t_o_n•46m ago
You mean like if you have two types which are identical but you want your type system to treat them as distinct? To me that's a data modelling issue rather than something wrong with the type system, but I understand how it can sometimes be unavoidable and you need to work around it.

I think it also makes more sense in immutable functional languages like clojure. Oddly enough I like it in Go too, despite being very different from clojure.

andyferris•34m ago
If I understand you correctly - in popular structurally typed languages, sure.

It seems ok in upcoming languages with polymorphic sum types (eg Roc “tags”) though?

lmm•24m ago
I think that's backwards - ultimately everything on a computer is just bytes, so if you push that philosophy to the limit then you would write untyped functions and they can "just work" on any input (just not necessarily giving results that are sensible or useful if the input is wrong). The point of a type system is to help you avoid writing semantically wrong code, to bring errors forward, and actually the most important and valuable use case is distinguishing values that are structurally identical but semantically different (e.g. customer ID vs product ID, x coordinate vs y coordinate, immutable list vs read view of mutable list, sorted vs unsorted...).
b_e_n_t_o_n•10m ago
I think the structural type approach leans heavily into the "computation is just data and its transformations", so it makes sense for it to treat data as the most important thing. You end up thinking less about classification and more about the transformations.

I'm not saying the nominal approach to types is wrong or bad, I just find my way of thinking is better suited for structural systems. I'm thinking less about the semantics around product_id vs user_id and more about what transforms are relevant - the semantics show up in the domain layer.

Take a vec3 for example, in a structural system you could apply a function designed for a vec2 on it, which has practical applications.

seanmcdirmid•23m ago
Structural type systems mostly don’t support encapsulation (private members that store things like account numbers) without some sort of weird add on, while nominal type systems support encapsulation directly (because the name hides structure). The canonical example is a cowboy and picture that both have a draw method.
b_e_n_t_o_n•15m ago
Both Go and TS are structural and support encapsulation fine, I'm not sure why that would be an issue.
seanmcdirmid•11m ago
TS doesn’t really. TS simply treats private fields as public ones when it comes to structural type checks. TS is unsound anyways, so not providing hard guarantees about field access safety is right up its alley. More to the point, if you specify a class type with private fields as a requirement, whatever you plug into that requirement has to have those private fields, they are part of the type’s public signature.

To get where structural type systems fall down, think about a bad case is when dealing with native state and you have a private long field with a pointer hiding in it used in native calls. Any “type” that provides that long will fit the type, leading to seg faults. A nominal type system allows you to make assurances behind the class name.

Anyways, this was a big deal in the late 90s, eg see opaque types https://en.wikipedia.org/wiki/Opaque_data_type.

skybrian•1h ago
The author seems concerned about compile-time range checking: did you handle the full range of inputs?

Range checking can be very annoying to deal with if you take it too seriously. This comes up when writing a property testing framework. It's easy to generate test data that will cause out of memory errors - just pass in maximum-length strings everywhere. Your code accepts any string, right? That's what type signature says!

In practice, setting compile-time limits on string sizes for the inputs to every internal function would be unreasonable. When using dynamically allocated memory, the maximum input size is really a system property: how much memory does the system have? Limits on input sizes need to be set at system boundaries.

b_e_n_t_o_n•52m ago
Perhaps it's because I'm not a haskeller but I'm not sure if I'm sold on encoding this into the type system. In go (and other languages for example), you would simply use a struct with a hidden Int, and receiver methods for construction/modification/access. I'm not sure I see the benefit of the type ceremony around it.
the_af•33m ago
Isn't the whole article a discussion of the kind of guarantees such an approach (which can also be done in Haskell) cannot provide?
b_e_n_t_o_n•26m ago
Right, I'm just unsure how valuable those guarantees really are. Especially if I'm extracting an Int out of the type to interface with other code.
andyferris•29m ago
These are possibly situations where I’d resort to a panic on the extra branch rather than complicate the return type.

Providing a proof of program correctness is pretty challenging even in languages that support it. In most cases careful checking of invariants at runtime (where not possible at compile time) and crashing loudly and early is sufficient for reliable-enough software.

valenterry•16m ago
Title should been "names are not ENOUGH for type-safety" but then no one would have read it I guess...