Ah! it is so very much better to have some example when it comes to exchanging ideas!
(Must remember that when I myself am about to post my own design thoughts)
For ease of speech, I'd like to call your
Code: Select all
System::FileOpeners["markup"]["xml"]
) a "mime-type" mechanism.
So that approach should become a bit complexer - e.g. when you wish to group and categorize your "files", an jpg-image file could also be seen as source of arbitrary "entropy" input for some encryption prog. That itself would maybe not be interested in loading esp. "images", but files of type "entropy source". Ah how to explain...
Better example...
You have a file that is a text file, and you can open it with editor. Maybe encoding is UTF-8. As subtype.
The same file could be categorized as CLI/shell script, becuase of it's internal structure (e.g. begins with hashbang #!)
The same file could be categorized as python script, because of it's internal structure (e.g. begins with hashbang #!/usr/bin/env python)
The same file could be categorized as python module, because of it's internal structure (e.g. begins with hashbang #!/usr/bin/env python,
but then also has something in it ( e.g. somewhere is the script part at "__init__" , but the rest is a full grown python module, allowing it to be "imported".
The same file could be feed to a documentation extraction prog like pydoc, which takes it as a source of interesting literals (e.g. contains some """ Docstrings""")
Then you have tools that make statistics of your "Filesystem" like "how much "entropy" your filesystem overall has, average size, or whatever.
----> So you could feed it equally best to editor, shell, python, pydoc-tool, or indirect as part of another python prog etc. etc.
And maybe the progs are not sure, what mimetype it's input will be of.
What I want to say: Such multy-purpose files are not rare, but
that is a general property of data!
Semantic of given "file" is not a static and simple thing! And can change with lifetime.
I could think, that your design could be improved to
allow each file having several mimetypes. Otherwise you will face problems of the real "mimetype", e.g. that in e.g. browser everything must default to "unknown"/octet-stream, because your app does not recognize that specific mimetype.