scope

Tyler Close tyler@lfw.org
Thu, 22 Oct 1998 11:54:33 -0400


Still trying to get my mind around the grammar and thought of something
that may already be implied by the grammar or may be a new idea, I'm not
sure which.

If you have something like:

to foo(arg1, arg2)
{
	scope
}

It seems to me that the above code actually instantiates a new object of
type foo with private data members arg1, arg2 and no methods.

Therefore, if you had something like:

to foo(arg1, arg2)
{
	to bar(arg)
	{
		# bar this foo
	}

	scope
}

I think this would instantiate a new object of type foo with private data
members arg1, arg2 and public method bar(arg).

Further, if you had:

to foo(arg1, arg2)
{
	to bar(arg)
	{
		# bar this foo
	}

	buffer = { 0 ... 8 }
	scope
}

I think this would instantiate a new object of type foo with private data
members arg1, arg2, buffer and public method bar(arg); where arg1 and arg2
are persistent members and buffer is transient.

Further again:

to foo(arg1, arg2)
{
	to bar(arg)
	{
		# bar this foo
	}

	to face()
	{
		to baz(arg)
		{
			# baz this foo
			...
			bar(arg)
			...
		}

		scope
	}

	buffer = { 0 ... 8 }
	face()
}

I think this would instantiate a new object of type face with private data
members arg1, arg2, buffer and private method bar(arg) and public method
baz(arg); where arg1 and arg2 are persistent members and buffer is transient.

Well, that's as far as I've taken it so far. I think this is pretty cool.
Is this what scope is for?

Tyler