Claims
- 1. A programming language used in the creation of computer programs that may comprise both dynamically scoped variables and statically scoped variables so that a programmer may select which scoping is desired for a particular variable when creating a computer program, the programming language comprising:
at least one language construct for defining statically scoped variables to be used if a static scoped variable is desired; and at least one language construct for defining dynamically scoped variables to be used if a dynamic scoped variable is desired.
- 2. The programming language of claim 1, wherein the language construct for defining dynamically scoped variables comprises a statement for identifying an instance of a dynamically scoped variable and for defining a scope for the instance of the dynamically scoped variable.
- 3. The programming language of claim 2, wherein the language construct for defining dynamically scoped variables further comprises a parameter for specifying a data type for the instance of the dynamically scoped variable.
- 4. The programming language of claim 3, wherein the language construct for defining dynamically scoped variables further comprises a parameter for specifying an initial value for the instance of the dynamically scoped variable.
- 5. The programming language of claim 4, wherein the scope of the instance of the dynamically scoped variable comprises an executable code segment of the program.
- 6. The programming language of claim 5 further comprising a table, and wherein an entry is created in the table for the instance of the dynamically scoped variable when an instance of the language construct for defining dynamically scoped variables is compiled, the table entry comprising boundaries of the executable code segment, the data type for the instance of the dynamically scoped variable, and a name for the instance of the dynamically scoped variable.
- 7. The programming language of claim 6, wherein the scope of the instance of the dynamically scoped variable comprises the executable code segment and all functions called within the thread.
- 8. The programming language of claim 6 further comprising at least one language construct for referencing dynamically scoped variables.
- 9. The programming language of claim 8, wherein the language construct for referencing dynamically scoped variables binds a variable to the instance of the dynamically scoped variable.
- 10. The programming language of claim 9, wherein the language construct for referencing dynamically scoped variables comprises a parameter for specifying a type for the variable, and wherein the variable is bound to the instance of the dynamically scoped variable only if the type of the instance of the dynamically scoped variable is the same type or a subtype of the type of variable.
- 11. The programming language of claim 10, wherein the language construct for referencing dynamically scoped variables comprises a statement for defining a scope for the variable.
- 12. The programming language of claim 11, wherein the variable is bound to the instance of the dynamically scoped variable only once for all accesses to the variable that occur within the scope of the variable.
- 13. A computer-readable medium comprising instructions which, when executed by a computer, cause the computer to provide the programming language defined by claim 1.
- 14. A computer-controlled apparatus capable of providing the programming language defined by claim 1.
- 15. A method for providing dynamically scoped variables within a programming language in which variables are statically scoped, comprising:
providing within the programming language at least one construct for declaring dynamically scoped variables; and providing within the programming language at least one construct for accessing dynamically scoped variables in a defined scope.
- 16. The method of claim 15, wherein the construct for accessing dynamically scoped variables binds a variable to an instance of a dynamically scoped variable.
- 17. The method of claim 16, wherein the construct for accessing dynamically scoped variables comprises a parameter for specifying a type for the variable, and wherein the variable is bound to the instance of the dynamically scoped variable only if the type of the instance of the dynamically scoped variable is the same type or a subtype of the type of variable.
- 18. The method of claim 17, further comprising:
creating an entry in a table corresponding to the instance of the dynamically scoped variable when an instance of the language construct for declaring dynamically scoped variables is compiled, the table entry comprising the boundaries of an executable code segment in which the dynamically scoped variable is defined, the data type for the instance of the dynamically scoped variable, and a name for of the instance of the dynamically scoped variable.
- 19. The method of claim 18, wherein binding the variable to the instance of the dynamically scoped variable comprises:
locating an entry in the table wherein the identity of the variable is the same as the identity of the instance of the dynamically scoped variable and the data type of the instance of the dynamically scoped variable is the same data type or a subtype of the variable; and in response to locating the entry in the table, equating the instance of the dynamically scoped variable to the variable based upon the boundaries of the executable code segment identified in the located entry
- 20. The method of claim 19, wherein equating the instance of the dynamically scoped variable to the variable comprises causing read and write operations on the variable to be performed on the dynamically scoped variable.
- 21. A computer-readable medium comprising instructions which, when executed by a computer, cause the computer to perform the method defined by claim 1.
- 22. A computer-controlled apparatus capable of performing the method defined by claim 1.
CROSS REFERENCE TO RELATED APPLICATIONS
[0001] This application claims the benefit of provisional U.S. patent application No. 60/337,350, filed Nov. 30, 2001, and which is expressly incorporated herein by reference.
Provisional Applications (1)
|
Number |
Date |
Country |
|
60337350 |
Nov 2001 |
US |