proposed WebDAV mapping

So I’ve got a class called “Spoon” which services requests about Spoon from the rest of the world, via WebDAV. In particular, I provide the illusion of a filesystem that can be mounted by other operating systems. Editing certain of those virtual files invokes behavior within Spoon.

Here’s a summary of that filesystem:

/
  /bin/
    (frequently-used expressions, presented as executable files)
  /classes/
    (all the classes)
    ...
    /classes/<class>/
      (a file for each method of <class>)   
  /do (a file to which one write a method, which is
           then executed, leaving the result as the
           file contents)
  /notes/ (a normal directory, for use as a staging
           area for "do" files, for example)

Here’s what you might see at a shell on a machine which has a mounted Spoon system:

craig@netjam spoon> pwd
/Volumes/spoon
craig@netjam spoon> ls
classes/  notes/  do
craig@netjam spoon> cd classes
craig@netjam classes> ls
Object/
craig@netjam classes> cd Object
craig@netjam Object> ls
Boolean/  Collection/  (etc.)
craig@netjam Object> cd Boolean
craig@netjam Boolean> ls
and:  ifFalse:  ifTrue:  (etc.)
craig@netjam Boolean> more ifTrue:
ifTrue: aBlockClosure
  "If I am true, answer the value of aBlockClosure. Otherwise, answer nil."

  self subclassResponsibility
craig@netjam.org Boolean> cd /Volumes/spoon
craig@netjam.org spoon> echo "3 + 4" >! do
craig@netjam.org spoon> more do
7
craig@netjam.org spoon> cd /bin
craig@netjam.org bin> ls
snapshot  (etc.)
craig@netjam.org bin> snapshot

This seems like the minimal functionality. What else would be nice or fun to have?

10 Responses to “proposed WebDAV mapping”

  1. /bin/senders /Classes/Object/printOn:
    /bin/implementors /Classes/Object/printOn:
    /bin/references /Classes/Object
    /bin/smalllintMessagesSentButNotImplemented
    rm –safely someMethod

    # next line: refactoring browser’s push method up
    mv printOn: ..

    Like

  2. Hi Craig,

    that looks like a very interesting idea. I have just a small concern about this do file. Why would you replace the file content by the result instead of putting the result in a /result file? That might no be a problem, but it looks suspicious.

    Is it possible to pass parameters to the executables in /bin?

    If you introduce packages/categories in Spoon, it might be worth reflecting this in a new entry point (e.g., /packages/collections/arrayed/Array). Same thing for protocols (e.g., /…/aClass.protocols/accessing).

    Do you also plan to access/modify objects in this filesystem?

    Going a bit further, do you think it could be possible to implement a Smalltalk application by only using Bash syntax?

    Like

    • Craig Latta Says:

      Yeah, a /result file makes sense.

      Sure, one could pass parameters to the bin executables. I like Bob’s example above.

      Oh yes, there are a lot of things to be done with Naiad modules and module/class/method/author tags.

      I’d like to be able to manipulate individual objects as well, but I’m not sure how yet. I think being able to write a Smalltalk application as a shell script would be fun, in a twisted way. :)

      Like

  3. Not sure how the /bin directory would work. Reading a file from there would execute it? Because this is a regular shell, right? The filesystem would only see the read request. So no arguments. Unless you cleverly return an actual executable that somehow works on that platform and does something incredibly clever? IMHO this looks like taking the idea too far ;)

    Like

    • Craig Latta Says:

      Oh, good point. I guess every command could be a directory instead of a file, and you could write the arguments into a special file in the directory (it could even be a form you fill out). Clunky, but it could work.

      Like

      • I think it would be a good idea to learn from Linux’s /proc interface. This is how you interact with the kernel through a files system, writing into and reading from what looks like files. The files are created by the system.

        OTOH I am not sure you actually need more than the “do” mechanism, it can execute any message, right?

        echo 3 + 4 > do ; cat do
        echo Smalltalk snapshot > do

        For more fancy interaction you could have a web browser interface.

        Or for geek cred, a telnet interface.

        Like

  4. Instead of replacing the contents of a special file name, why not use STDIN/STDOUT?

    craig@netjam.org spoon> echo “3 + 4” | bin/doIt

    craig@netjam.org spoon> echo “3 + 4” | bin/printIt
    7

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: