Index: openacs-4/packages/acs-core-docs/www/xml/developers-guide/programming-with-aolserver.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-core-docs/www/xml/developers-guide/programming-with-aolserver.xml,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-core-docs/www/xml/developers-guide/programming-with-aolserver.xml 13 Mar 2001 22:59:26 -0000 1.1 +++ openacs-4/packages/acs-core-docs/www/xml/developers-guide/programming-with-aolserver.xml 2 Feb 2002 03:47:32 -0000 1.2 @@ -15,14 +15,14 @@ -Server-global: As you'd expect, there is +Server-global: As you'd expect, there is only one server-global namespace per server, and variables set within it can be accessed by any Tcl code running subsequently, in any of the server's threads. To set/get server-global variables, use AOLserver 3's nsv API (which supersedes ns_share from the pre-3.0 API). -Script-global: Each Tcl script (ADP, Tcl page, +Script-global: Each Tcl script (ADP, Tcl page, registered proc, filter, etc.) executing within an AOLserver thread has its own global namespace. Any variable set in the top level of a script is, by definition, script-global, meaning that it is accessible only by subsequent @@ -64,9 +64,9 @@ time the task is executed - and it is a very expensive process that should not be taken lightly! -The moral: if you have a lightweight scheduled procedure -which runs frequently, don't use the -thread -switch. +The moral: if you have a lightweight scheduled procedure +which runs frequently, don't use the -thread +switch. @@ -128,11 +128,11 @@ more than one value from a function. When to use which depends on the circumstances. -Using Arrays and Pass-By-Value +Using Arrays and Pass-By-Value -The one we generally prefer is returning an array -get-formatted list. It has all the nice properties of +The one we generally prefer is returning an array +get-formatted list. It has all the nice properties of pass-by-value, and it uses Tcl arrays, which have good native support. @@ -172,7 +172,7 @@ -Using Arrays and Pass-By-Reference +Using Arrays and Pass-By-Reference Sometimes pass-by-value incurs too much overhead, and you'd rather @@ -189,8 +189,8 @@ almost not at all on the size of the entries. -You implement pass-by-reference in Tcl by taking the name of an array -as an argument and upvar it. +You implement pass-by-reference in Tcl by taking the name of an array +as an argument and upvar it. @@ -221,17 +221,17 @@ upvars through several layers of the call stack, you'll have a hard time debugging. -Multisets: Using ns_sets and Pass-By-Reference +Multisets: Using ns_sets and Pass-By-Reference An array is a type of set, which means you can't have multiple entries with the same key. Data structures that can have multiple entries for the same key are known as a multiset or bag. -If your data can have multiple entries with the same key, -you should use the AOLserver built-in -ns_set. You can also do a case-insensitive lookup on an +If your data can have multiple entries with the same key, +you should use the AOLserver built-in +ns_set. You can also do a case-insensitive lookup on an ns_set, something you can't easily do on an array. This is especially useful for things like HTTP headers, which happen to have these exact properties.