Skip to content

Comment on Version control second comingparent

Comments

Sure!

To start:

An operating system is a collection of things that don’t fit into a language. There shouldn’t be one.

— Dan Ingalls, https://www.cs.virginia.edu/~evans/cs655/readings/smalltalk....

Let's start with an example, the Objective-Smalltalk equivalent of Python's simple web-server for a directory.

Python:

    python3 -m http.server 8000
This serves the current directory on port 8000. The invocation for the Objective-Smalltalk script doing the equivalent job looks as follow:
   ./simplefileserver.st ./ 8000 
Here is the Objective-Smalltalk 'simplefileserver.st' script:
   #!env st
   #-server: <ref>dir port: <int>port
   framework:ObjectiveHttpd load.
   dir asScheme waitOnPort: port.

If you look carefully, you'll notice that this doesn't actually say anything about the filesystem. It just expects an argument 'dir' that is a 'ref' and then goes from there.

Here are some other example of what a "ref" can be:

   ./simplefileserver.st https://objective.st 8000
   ./simplefileserver.st sftp://otherhost.local 8000
   ./simplefileserver.st env: 8000
   ./simplefileserver.st defaults: 8000
   ./simplefileserver.st class: 8000
   ./simplefileserver.st scheme: 8000
The first will make this server act like an http proxy, the second will serve a remote directory, the third will serve our environment variables, the fourth will serve the contents of our process's defaults database (a macOS/iOS thing), the fifth our classes and the sixth the contents of the scheme registry where all the other schemes listed so far are registered.

"Ref" is anything referencable by a polymorphic identifier, a slightly adapted version of a URI. And any ref can be turned into a store (aka "scheme-handler"). And a store can be literally anything that can store and retrieve data by key/index/name/path, from local variables via filesystems, databases all the way to the World Wide Web.

So you can see that you can get the same location transparency that Plan 9 gives you without requiring operating system support. Which comes in handy when you can't switch to a new operating system. What's more, the support extends to a lot of things even Plan 9 probably wouldn't consider a filesystem (local variables?). Last not least, this does not require accessing everything via POSIX API and a byte-serialized representation. Definitely not "least"!

You can access via a byte-serialized representation (as via the http server above) if you want, and you can even access via POSIX API (there is a generic fileserver that serves any of these stores / scheme handlers) if you really, really want. I am not at all sure why you would want that.

And you can, of course, also access this via any language that can talk to C as the libraries that implement the functionality are written in portable Objective-C. Objective-Smalltalk just provides the proper linguistic support.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.