Questions have been raised following the implementation of a handful of schemes in the ReplPad package. A prominent aspect of this is whether a URL can be set to the current path and how each scheme handles this and path changes via relative file through CHANGE-DIR
There are eight schemes in all: FILE, DIR, HTTP, HTTPS, STORAGE, CLIPBOARD, LOG and DOWNLOADS. In implementing them, the first four are moot—you can set them via change-dir and the FILE/DIR schemes know to map relative files to those schemes.
In designing the latter four there are different considerations—none map to a hierarchical filesystem, thus I sought to avoid structuring them in the traditional thing:// form.
-
Storage — maps to key/value storage, so it uses a plain storage:key form:
read storage:key write storage:another-key "Something"
It could stand to distinguish between localStorage and sessionStorage—for another day.
-
Clipboard — doesn't have any prescribed form, just simply saying the following is enough and equivalent:
write clipboard:// "Something" write clipboard::foobar "Something" ; read is not feasible
As a side note, in a Mac implementation, I use the following forms to distinguish between different available text clipboards:
clipboard::general clipboard::ruler clipboard::font clipboard::find
-
Log — for this scheme, I possibly could've gone for the double-colon again, but opted for a triplet. There are precisely four endpoints:
log:type=log log:type=info log:type=warn log:type=error
-
Downloads — for this scheme, the argument is a variable single filename, I opted for downloads:/// so as to take advantage of DECODE-URL extracting that name for us:
write downloads:///data.bin #{CAFEF00D}
It will ignore any values between the second and last slash, though it doesn't check for conformance.
Each one of these is a subjective choice that I made.
Amongst the questions raised:
-
Is there significance in deviating from the traditional scheme:// format when you couldn't conceivably say: change-dir log:type= and then say: write %error "Foo"?
-
Is this the right design direction to go in at all when you could just write functions that say download or log/warn or write-clipboard?
My shorter opinions on this are 1) no—I'm not suggesting these forms are ideal, but there are prominent URL schemes that don't adhere to this form, for example: tel: and mailto:. I think that URLs should be constructed to fit their domain. 2) yes—URLs and Ports represent abstract external resources; schemes offer versatility on how the standard verbs adapt to their domain rather than introducing many domain-specific verb constructions.