Comment

Comment by TheLoneWolfling

Personally, I wish that type systems allowed for arbitrary pure (as in "same input -> same output") code to define what is and isn't a valid instance of a type at compile time.

Being able to declare a function that is only valid for, say, power of two inputs (say: a hashmap's initial size, when the hashmap is using a bitwise and for wrapping) and having it actually enforced at compile time would be very useful.

I mean, even range types are useful.

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton