[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Sc-devel] pseudovariables



Hi all,

It appears that pseudovariables are undocumented - they definitely should be discussed in the book. I poked around in the source and it appears that they come into existence different ways.

I am aware of:
	thisProcess
	thisThread
	thisMethod
	thisFunction
	thisFunctionDef
which are explicitly enumerated as pseudovariables in Opcodes.h

There are also
	currentEnvironment
	topEnvironment
	dependantsDictionary
	uniqueMethods

which are created as class variables of Object.
Oddly, dependantsDictionary and uniqueMethods can be accessed either directly, pseudo-variable style
or as class variables.

Are there others? Can anyone explain how to track them all down?

Also, can anyone give a brief handle on how all of this is implemented in the language source?

RJK


On Nov 25, 2007, at 5:52 AM, Dan Stowell wrote:

Hi Ron -

Good point. It would be nice to have a help doc to point out these
pseudovariables. For example, thisProcess is used in passing in two
help files (Platform, SkipJack) but not actually documented.
thisFunction isn't mentioned anywhere in help.

The "Environment" help doc describes currentEnvironment and
topEnvironment very nicely.

currentEnvironment is used in lots of help docs, although
Streams-Patterns-Events4 mistakenly calls it a class variable of
Object.

Dan


2007/11/25, ronald kuivila <rkuivila@xxxxxxxxxxxx>:

Hi James,

You are quite right. No that I am thinking about it, currentEnvironment is
a pseudovariable, so it suffices to write

 envir = envir ? currentEnvironment;

Hmm, is anyone writing about pseudovariables?
As far as I know, there is no help page.

RJK



On Nov 24, 2007, at 6:29 PM, James Harkins wrote:

Works for me, thanks. I will probably keep the e short form in my library, especially since there is already the precedent of single letter methods for Function -- if we can have p and r, why not e? :) But I won't ask for that
to go into the main library.

Oops... I just read this more carefully. It won't work. You have to save the
environment outside the returned function. The whole problem is that
currentEnvironment is not the expected environment inside the function!

+ Function {
 inEnvir { |envir|
 envir = envir ?? {currentEnvironment};
 ^{ |... args| envir.use({ this.valueArray(args) }) }
 }
}


hjh



On Nov 24, 2007, at 4:35 PM, Dan Stowell wrote:

How about something along the lines of

+ Function {
 inEnvir { |envir|
^{ |... args| (envir ?? {currentEnvironment}).use ({ this.valueArray(args)
}) }
 }
}


: H. James Harkins
: jamshark70@xxxxxxxxxxxxxxxxx
: http://www.dewdrop-world.net
.::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..:

"Come said the Muse,
Sing me a song no poet has yet chanted,
Sing me the universal."  -- Whitman
_______________________________________________
Sc-devel mailing list
Sc-devel@xxxxxxxxxxxxxxx
http://www.create.ucsb.edu/mailman/listinfo/sc-devel

_______________________________________________
Sc-devel mailing list
Sc-devel@xxxxxxxxxxxxxxx
http://www.create.ucsb.edu/mailman/listinfo/sc-devel




--
http://www.mcld.co.uk
_______________________________________________
Sc-devel mailing list
Sc-devel@xxxxxxxxxxxxxxx
http://www.create.ucsb.edu/mailman/listinfo/sc-devel