|
On Dec 22, 2007, at 3:03 PM, William Brent wrote: thanks to all. that works. Unfortunately, that isn't possible structurally. To execute any code, the interpreter has to compile it first into a function, which it then executes. Any variables that you declare belong to that function. In a way, you're asking for the following: f = { var aa = 1; g = { var bb = 2; bb }; aa + bb // the variable bb to be accessed outside its scope } ... which is an interesting idea, but that would open up the following ambiguity which could not be supported logically at all: f = { g = { var aa = 1; aa }; h = { var aa = 2; aa }; aa }; What should this function return? 1 or 2? There is, of course, no correct answer, and SuperCollider properly prevents you from writing this. So, if you want a variable namespace that persists across multiple files (and, thereby, multiple function definitions), environment variables are the right way to go. (You might also search the archives for an earlier post of mine explaining why environment variables are technically not global variables, even though you can use them as such.... oh, here it is... http://www.nabble.com/question-about--7E-to11295150.html#a11320423 ) hjh : 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 |