On Mon, 24 Nov 2003, T. Onoma wrote:

> On Sunday 23 November 2003 10:51 pm, Mathieu Bouchard wrote:
> > That's what LISP already had before most languages went into existence,
> > and that I've been dreaming about for Ruby, and that I've been begging
> > Matz to add to Ruby, since back when Ruby 1.6 was also a dream. Then I've
> > wrote several letters in favour of the inclusion of that feature, and
> > after receiving not enough approval, I abandoned those ideas, about two
> > years ago. At that moment I had a spec and half of an implementation.
> 
> Exactly! I actually worked up an interesting notion about it myself,
> where the whole of Ruby's syntax could be viewed as nested collections
> of duplicate-key ordered maps --this superset collection would then
> allow for subset views like array. So an assignment, i = true, for
> instance, is equavalent to :i => true. A statement without "assignemt"
> is annonymous, nack => print "A".

I don't have an assignment-centric view of that. I tend to organize all my
stuff into structs. I made my own metadata system to describe types in a
more detailed way than just using class names. The "schema" is a
specification for data exchange between "compiler components", that is,
any component that accepts or produces ruby code but not as a big string.

It is similar to Ruby's internal AST storage, except it's designed to be
convenient from the perspective of program that process code, whereas
Ruby's system is designed to be processed by Ruby's internals and nothing
else. (It uses pseudoobjects that aren't normally accessible from programs
written in Ruby)

> How did you approach it?

RubySchema.rb was the specification for ruby code structures:

http://www.ruby-lang.org/cgi-bin/cvsweb.cgi/~checkout~/lib/metaruby/RubySchema.rb?rev=1.14&content-type=text/plain

Type.rb was the specification for specifications in general:

http://www.ruby-lang.org/cgi-bin/cvsweb.cgi/lib/metaruby/Type.rb

and I was supposed to split RubySchema in two so that a subset of Ruby
could be factored out; that modularization of schemas would have helped
making more modular "compilers" and eliminate some forms of redundancy, as
several "compiler components" would instead process the "microruby
language" and there would be a ruby-to-microruby translator.

I stopped when I was rather close to having a conforming parser for Ruby
1.6 (I didn't write it, but I was modifying someone else's parser code).
[As we know, Ruby 1.8 is already slightly different.]

________________________________________________________________
Mathieu Bouchard                       http://artengine.ca/matju