Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Sure, you can follow along the old meme: https://twitter.com/vbhvsgr/status/1419369352164372482

Though in practice in decent languages it's much less likely you'd write your own `any -> any, any`-typed library for whatever (in this case DB interactions), and use a strongly typed one in which this would at least have been a much more explicit mistake to make.



But this isn't an `any -> any` case. They passed in a default value, as a string, which is the correct type for a default value for this column. Even with very strong typing they wouldn't have got a type error here right?


You can forbid static values and require it to be a function.

Generally, static languages will just culturally be less likely to have this kind of invisible "T | (() -> T)" overload.


You could make a special primary key column creation function that rejects static values.


You don't even have to reject/forbid them, just make their use explicit.


I thought this was going to be the xkcd ‘int rand() {return 6; //chosen by fair dice roll}’, which is more or less what they did lol.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: