Re: [PATCH v2 1/8] rust: fs: add file::Offset type alias

From: Miguel Ojeda

Date: Tue Oct 21 2025 - 12:01:00 EST


On Tue, Oct 21, 2025 at 5:26 PM Danilo Krummrich <dakr@xxxxxxxxxx> wrote:
>
> Yeah, I don't think there's any value making this a new type in this case. There
> are no type invariants, useful methods, etc.
>
> In fact, not even the type alias is strictly needed, as i64 would be sufficient
> as well.

Even if there are no type invariants nor methods, newtypes are still
useful to prevent bad operations/assignments/...

In general, it would be ideal to have more newtypes (and of course
avoid primitives for everything), but they come with source code
overhead, so I was wondering here, because it is usually one chance we
have to try to go with something stronger vs. the usual C way.

Cheers,
Miguel