9fans archive / 2001 / 11 / 766 /    prev next

From: Quinn Dunkan <quinn@reg...>
Subject: Re: [9fans] Python filesystem 
Date: Thu, 29 Nov 2001 21:44:51 -0800


> I know the answer to this mail should be :
> 
> "send us the code when it's finished"
> 
> but I've been musing the past couple of days about a python filesystem
> 
> python is not just a script interpreter but it is also a kind of shell

Yes, most languages have REPLs.

> fire it up without a script and you can execute commands 'interactively'
> 
> which means it's quite a candidate for a file system
> 
> is it a technique that is used anywhere else?

plumber?

> the ability to embed a programming language that an application can send code
>  
> to progressively sounds quite interesting

Isn't that just like creating a named pipe to a shell or REPL?  Isn't that
what acme's win does?

A while back I wrote a lua program that served lua variables---a table becomes
a directory and strings become files, and functions became files containing
whatever string the function returns when passed nbytes read (bytes written
are passed as a string).  And since most everything in lua is a table,
including the global namespace, you could assign variables by writing to
files.  It presented a possibly interesting debugging interface, but not
practical.  Type information is lost, because of table <-> directory and
everything else <-> bytes in file.  And it's purely value-oriented, so as long
as you're treating data functionally you're fine, but if you want to alias you
can't.

But it's a fun way to throw up a filesystem fast (or interactively, by
assigning to the served table from the REPL).