.WORD as Member Selection

I've shifted the mechanics of binding, such that WORD!s now capture the full binding environment.

A consequence of this is that "wordlike" sequences that are compressible to WORD! size--such as .foo--also do the same.

This makes it feasible to build the "magic" of behavior that .foo picks out of the "current object" as being simply a matter of giving the current object a name in the environment, and looking up that name. When a METHOD ran, it would use the "coupling" from the invocation to spread that name down...just like a definitional RETURN (or anything else) would.

I debated whether this name should be simply "dot" (.) or if it should be something more English-like, such as this. It seemed to me that dot was harder to see, and also maybe a bit confusing... because .foo would be equivalent to (.).foo, which looks strange. It seemed easier to explain that it was just a shorthand for this.foo

So I leaned to favoring this.

But /foo has a now very important meaning related to foo as an action antiform you want to run. That means it can't implicitly mean there's an invisible object on the left.

That makes a pretty strong argument for . being the WORD! used for the current object, because that gives ./foo as the way of running a member function out of the current object.

Do remember that people will be able to write something like: use . in their method body if they want to omit the dot on member accesses. But I think calling out the member accesses is worth it, and the notation is much lighter than requiring you to say this.foo or self.foo

Anyway, I'm moving ahead and ripping out the old frail hack that implemented the .WORD convention and replacing it with this, which has a more solid and reliable basis.

3 Likes