Concise Magic File Names

I'm not a fan of the primitive obsession here. Why "file_path (module_name)"? Why not a SwiftFileDescriptor struct, with fields like:

  • url: URL (relative to some portable base location),
  • name: String,
  • moduleName: String,
  • lineNumber: Int,

and perhaps a custom implementation of CustomStringConvertible that glues them together with spaces and parentheses and what not.

I say this because given the current design, I'm fairly certain that most call sites will be constantly calling components(separatedBy: " ").

2 Likes