Make Path a type #499

Open
opened 2024-09-01 22:45:31 +00:00 by rbt · 2 comments
Owner

Currently, Path and related types are type aliases for strings. This provides no type safety and makes it impossible to e.g. provide different template instantiations for paths and strings, even when semantics differ. Wouldn't it be nice if paths were a thin wrapper around strings with defined semantics? We can make it happen!

Currently, [`Path` and related types are type aliases for strings.](https://git.lix.systems/lix-project/lix/src/commit/02eb07cfd539c34c080cb1baf042e5e780c1fcc2/src/libutil/types.hh#L25-L31) This provides no type safety and makes it impossible to e.g. provide different template instantiations for paths and strings, even when semantics differ. Wouldn't it be nice if paths were a thin wrapper around strings with defined semantics? We can make it happen!
rbt added the
devx
label 2024-09-01 22:45:31 +00:00
Owner

Need to check what CanonPath does and how it should relate to this desired type. Other than that I'm for it.

Need to check what CanonPath does and how it should relate to this desired type. Other than that I'm for it.
Owner

CanonPath is much more restricted and can't be used here, but its interface is broadly fine to clone and make Path a concept. we'd suggest not using std::path just yet even if it looks appealing because we will absolutely die when given non-posixly paths (which std::path supports, and we currently treat posixly regardless)

CanonPath is much more restricted and can't be used here, but its interface is broadly fine to clone and make `Path` a concept. we'd suggest not using `std::path` just yet even if it looks appealing because we will absolutely die when given non-posixly paths (which `std::path` supports, and we currently treat posixly regardless)
Sign in to join this conversation.
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#499
No description provided.