|
|
|
|
|
by pveierland
122 days ago
|
|
When correctness is important I much prefer having strong types for most primitives, such that the name is focused on describing semantics of the use, and the type on how it is represented: struct FileNode {
parent: NodeIndex<FileNode>,
content_header_offset: ByteOffset,
file_size: ByteCount,
}
Where `parent` can then only be used to index a container of `FileNode` values via the `std::ops::Index` trait.Strong typing of primitives also help prevent bugs like mixing up parameter ordering etc. |
|