On Sunday 23 November 2003 10:51 pm, Mathieu Bouchard wrote:
> If it's just the look of "i=nil" that is a problem, then usually you can
> just do "i=true" and already it looks so much more assertive and positive.
> I mean, "i=true" looks like a bright sunny day, while "i=nil" looks like
> "i am nihil" and makes you think of romantic existentialists dressed in
> black in a dark smoky bar, muttering in a pathetically tragic dark voice
> that life is meaningless.

:)) (made my sunny day)  [Note: I tried to be witty in return, but you know, 
I'm just not going to top that. She's one for the books!]

> However sometimes i often need to incrementally construct an array with a
> loop, and #map doesn't always work for this, so i create a r=[] outside of
> the loop. Is that something you'd call ugly?
>
> > > > p.s. if you don't mind me asking, what do you think of Structural
> > > > Reflection?
> > >
> > > never heard about it, though the words do sound familiar. what is it?
> >
> > Refelection is when code can look at itself (inspection) and also
> > manipulate itself. So Ruby has reflection at the OO level. It's one of
> > the greatest things about Ruby. Structural reflection is a step or two
> > lower, where a language can actually manipulate its own statements,
>
> 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". def, 
class and module become associations to nested collections,  eg. def x; ... ; 
end, being equivalet to :x => { ... }. Even parameter lists become annonymous 
valued collections, (x,y) being { :x => nack, :y => nack }. perhaps a bit 
"out there". But an interesting unification of the whole of the language 
structure, nonetheless.

How did you approach it?

> > Actually, Ruby does have some *limited structural reflection* through
> > the use of eval.
>
> I don't really see how the current eval() has something to do with it.

Well, very limited. Probably not even worth mentioning, but you could do some 
tricky code wraps with alias and class_eval based on aritys, for instance.

-t0