> : on disk, in classic Mac OS, and at the Carbon layer in macOS; / at the Unix layer in macOS
APFS:
> In the Finder, filenames containing / can be created, but / is stored as a colon (:) in the filesystem, and is shown as such on the command line. Filenames containing : created from the command line are shown with / instead of : in the Finder, so that it is impossible to create a file that the Finder shows as having a : in its filename.
It doesn’t make sense tbh, it just causes confusion when someone is using terminal. Slashes in file names are forbidden everywhere except Mac, it needs to be changed in order to send it anywhere or use in some apps. But I think colon is used much more in names. I don’t get why did they do that.
Given the preponderance of 3 major operating systems, I'd think it's sensible for user-level applications to disallow creation of filenames that would cause problems on any of them. Except arguably that could even include using spaces or periods... obviously in an ideal world such restrictions wouldn't exist, but I'm not sure how to realistically push for such a world. E.g. my suggestion would be to reserve non-printable characters (below Ascii 32) for use as separators/delimiters in as many contexts where that's workable. Obviously some sort of convention would then need to exist as to how they were displayed and typed in, and I very much doubt I'll ever see it happen, but I'm sure it would solve a lot of mis-parsing bugs that show up with frustrating regularity.
I see your point, but forbidding slashes, the weird Windows reserved names, maintaining case insensitivity (also Windows), and forbidding colons doesn't seem like the craziest restrictions on file names. It can definitely get out of hand, though, if you start excluding too much stuff. IIRC, Azure doesn't even allow slashes in storage account names which greatly limits naming schemes and goes too far in my opinion.
Slashes are used in paths, so most programs that aren’t Mac-exclusive would use them to build a path to file. To make it work properly in cross-platform programs you’d need to write platform-specific code to handle that. It just adds complexity and possible errors. Even system terminal doesn’t display it as slash and it doesn’t work if you write slashes.
For users of other platforms (at least 90% of desktop market) it would just display as slashes. Just not implementing this workaround would make it predictable when moving and using files.