News for hackers. Stuff that matters.
Re:What should a Ruby shell look like? by derefr on Thursday March 19, 2009 @08:34PM (#524272)
I was going this direction a month or two ago. I was in one of the (Windows) CS labs in school, and was annoyed at the monstrosity that is cmd.exe. I noticed that, because the school had a full dump of Cygwin installed on one of the network servers, I had Ruby available (up until that point, I'm guessing the executable had never even been run before.) So, I started writing a shell; I called it Plush (the logo was going to be a stuffed animal of some sort).

At first, I just wanted a self-contained, cross-platform ruby shell, that I could pop open from any computer without having to (or being able to) install anything (with rubyscript2exe in case there was no Ruby around.)

Then, I started adding all sorts of neat convenience methods. I sort of wanted to imitate Powershell, but then I started wanting even more. Basically, I was going to implement a version of Plan 9, but with an Object system instead of a filesystem. I wrote up a user story that went like this:

        ~$ self
	=> #<Home @user=#<User ...>>
	~$ x = "hello"
	=> "hello"
	~$ ls
	=> x
	~$ cd x
	~/x$ ls
	class -> /lib/String
	methods/
	~/x$ cd methods
	~/x/methods$ ls
	capitalize
	chomp
	downcase
	[etc]
	~/x/methods$ ./capitalize
	=> "Hello"
	~/x/methods$ cd capitalize; ls class
	class -> /lib/Method
	~/x/methods/capitalize$ cd !; ls
	class -> /lib/String
	methods/
	~/x/methods/capitalize/!$ inspect  # ./methods is first in /etc/path
	=> "Hello"
It got even more complex from there, where entering an executor (a !/ directory) of a method with parameters would put you in a closure, that you had to then curry by putting new objects into each successive directory... I sort of gave up when I saw how obtuse the syntax was. It was sort of like LISP, but with paths instead of linked lists. :)

There are no comments on this comment yet.