3 ms·
It really depends. Do you usually keep hostnames as strings? URLs? JPEGs? Why or why not? Sure, a browser will hopefully quickly parse that URL and break it up
by anyfoo 5y ago
It really depends. Do you usually keep hostnames as strings? URLs? JPEGs? Why or why not?
Sure, a browser will hopefully quickly parse that URL and break it up, an image viewer will do the same with a JPEG. Will anything that's only interested opening/displaying that URL or JPEG, through a library or external program?
POSIX paths are actually remarkably simple in structure[1]. The only caveat is equality and normalization: Without normalization, a path a might be equal to a path b while their representations differ, e.g. "/etc/foo" and "/etc/bar/../foo". But this is the same whether you have a string or a list of strings, you need to normalize in whatever representation you choose to check for equality.
[1] Almost shocking myself, even Haskell defines its primary FilePath type literally as "String".