-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 10/14/2010 6:37 PM, David Korn wrote: > cc: [email protected] > Subject: Re: Re: [ast-users] Is there any way to create a variable with 'file global' scope? > -------- > > >> What do people think of adding some way (through typeset or not) to >> specify a 'file' scope? >> Is that too radical a change for KSH93? Is that the type of thing that >> would have to be in some future major version? >> >> -Kyle > > There are static variables inside function but this doesn't solve > the namespace problem. > How do you do a static function local variable? > I plan to add > > namespace name > { > } > > (it is already partially implements). > > variables and functions defined in the namespace are namespace specific > and will not intefere with other name spaces. > Can functions within the name space access the variables and other functions with the 'short' name? > You can call functions defined in another name space using the name > .namepace_name.function_name > Can variables be referenced from outside the namespace the same way? Can functions (or variables if the above answer is 'yes') be tagged as private? meaning can 'outside' access be blocked? Can functions be defined within the namespace (for better style/organization, and for easy access to other functions and variables,) and then optionally be 'exported' or made visible with a short name outside the namespace? For example, I write my libraries so that if the application wants to take on the risk of the name collisions, they can request that the library functions be made available with no naming prefix. I implement this like this: exampleLib_Func1() { ... } exampleLib_Func2() { ... } exampleLib_ShortNames() { Func1() { exampleLib_Func1 "$@"; } Func2() { exampleLib_Func2 "$@"; } } So if the application makes sure to call the ShortNames function, then it can acces the library directly, without the namespace prefix. So far in my experience the extra function call doesn't add too much overhead, but if there were a way that the library could selectively expose functions from inside the namespace without the prefix, that would be even better. -Kyle > I hope to complete namespaces before the end of this year if I can > find some time. > > > > David Korn > [email protected] -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (MingW32) iQEcBAEBAgAGBQJMt6jOAAoJEEADRM+bKN5wqIgH+wTVwfVjG3rxcknB8zAFHeeH 2YUKsL5ty+rIFum4GY4Fy5d9+ChdGM8IO+VCM/Qz8+RJS9O1SEePzeaSPc+NNIpY qUwVo5gX9aJqoIblEqp9C/rymsRxJN4E1sj+kuiff7cgSkvjgdyzgMXAofLkwX4s pspOT3Y9uGCSueoPM7ZsPiddfGVnKBr39RXFr8As17b9MY0I9PKPfRbpuAjDWpF5 HsdgfoFp7E5Jo25DGZYf8DFYzo2UR2AX9IeNL+upmx/ubNzqE9FGwgqKUiEwDDk2 EzXcyodfpbSf+MBcC1b/FCktoXlTWStUj7iuatc9oXOLpEKlYOjF8m2QlRmxCGA= =zV67 -----END PGP SIGNATURE----- _______________________________________________ ast-users mailing list [email protected] https://mailman.research.att.com/mailman/listinfo/ast-users
