Skip to content

Try to exploit newtypes over FilePath more to better separate semantics #249

@Martoon-00

Description

@Martoon-00

Clarification and motivation

After #230 we still have some ambiguities around FilePath, e.g. it may be always in Posix format or platform dependent.

I first abandoned this idea, but it starts getting more desired to me just as a measure to make the code more readable. Namely: let's introduce some MarkdownFilePath or PosixFilePath that would be used in markdown links. And leave FilePath for platform-dependent version of path.

This way one can easily understand the expected format at any place in the code just by looking at the type.

We may end up using posix-formatted paths in at least two places after #230 - in FileInfo and in error type, so having a separate type starts to make sense for me.

On implementation notes:

  • We will likely need to start separating local links and remote links in FileInfo, let's probably do so.

Acceptance criteria

  • We try to introduce the mentioned newtype.
  • Looking at the result, we assess how much sense it makes.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions