Hacker News new | past | comments | ask | show | jobs | submit login

> This is the same as my issues with Rust, if declaring a new type to represent a number of files isn't as easy as just using a u32 then no one will use it, etc..

    #[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
    #[repr(transparent)]
    pub struct FileCount(pub u32);
The annotations aren't needed until you make these part of your API and you want to communicate specific actions, but it's likely close what you'd end up with.

The first thing I'd do, and likely get away with, is

    struct FileCount(u32);
> My opinion is that the absolute safest way to do something needs to also be the easiest way to ensure that users always pick the safest option.

Agreed.






Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: