[0001] The invention relates to programming languages and in particular to an operator within a language that evaluates to “True” when two operands point to different locations in memory.

[0014] Such a language construction is ungrammatical, requires more typing and violates the philosophy on which BASIC rests. It would be helpful therefore, if a single more intuitive operator could perform the function that the combination of the two operators Is and Not typically performs.

[0013] Similarly, (for example), if a user wanted to perform Z if the variables a and b do not point to the same memory location, the following code, combining two operators, “Is” and “Not” (a negation of the expression) would be required: 3 Dim a, b As x a = New x( ) b = New x( ) . . . If Not (a Is b) Then (Perform Z) End If

[0012] Suppose the code represented by the ellipses has resulted in the situation illustrated in FIG. 1 b : variable a 256 is pointing to memory location 254 and variable c 262 is also pointing to memory location 256 . When the If statement is executed, Z will be performed because variables a 256 and c 262 both point to the same location (location 254 ) in memory.

[0011] Suppose the code represented by the ellipses above has resulted in the situation illustrated in FIG. 1 a : variable a 256 is pointing to memory location 254 while variable b 258 is pointing to memory location 260 . Hence, Z will not be performed because variables a and b do not point to the same memory location. It will be noted that, the execution of the statement “a Is b” thus determines whether or not the variables a and b point to the same memory location rather than whether or not a is equal to b. In contrast, consider the following code: 2 Dim a, c As x a = New x( ) c = New x( ) . . . If a Is c Then (Perform Z) End If

[0010] In BASIC, an operator called “Is” allows a comparison of two variables to determine if both variables are pointing to the same memory location. For example, when executing the following code: 1 Dim a, b As x a = New x( ) b = New x( ) If a Is b Then (Perform Z) End If

[0009] The first line of code defines variable a to be of class x while the second line creates a new instance of x 254 on the heap, a pointer to which is stored in variable a 256 .

[0006] Class x in this case is defined to contain a member of type “Integer”, which is to say that if the item stored at memory location 252 is a variable of class x, the contents of memory location 252 will comprise an Integer. Suppose now that the following code is executed:

[0002] BASIC, (Beginner's All Purpose Symbolic Instruction Code), was designed to be an easy-to-learn programming language that makes programming easier by providing an intuitive, English-like syntax in which to code. One of the ways in which BASIC eases programming tasks is by not requiring the use of pointer arithmetic. For example, referring now to FIG. 1 a , when a BASIC program is executing, a memory buffer 250 (typically a heap) is created in RAM (random access memory) to store application data. When a new object is created, space for the object is allocated on the heap. The new object is represented in FIG. 1 a by the box labeled 252 , representing a location in memory where the new object is stored. For example, suppose the following BASIC code defining a class x is executed:

[0015] A system, method and computer-readable medium support the use of a single operator that allows a comparison of two variables to determine if the two variables point to different locations in memory, that is, the reverse of the existing “Is” operator in a BASIC programming language or a derivative of BASIC or BASIC-like programming language. In one embodiment of the invention, the memory locations represent objects. The new operator enables a user to determine if the left operand (e.g., a reference type) “is not” the same instance as the reference type listed as the right operand. The use of a single operand for this concept may increase the readability of the programming language.

[0021] FIG. 4 is a flow diagram of an exemplary method for generating code for determining whether two variables are pointing to different locations in memory in accordance with one aspect of the invention.

[0019] FIG. 3 a is a block diagram of an exemplary system comprising a design environment comprising a compiler for generating code for determining whether two variables are pointing to different locations in memory in accordance with one aspect of the invention;

[0016] The foregoing summary, as well as the following detailed description of preferred embodiments, is better understood when read in conjunction with the appended drawings. For the purpose of illustrating the invention, there is shown in the drawings exemplary constructions of the invention; however, the invention is not limited to the specific methods and instrumentalities disclosed. In the drawings:

DETAILED DESCRIPTION OF ILLUSTRATIVE EMBODIMENTS

Overview [0022] A single operator compares two operands to determine if the two operands point to different memory locations. The memory locations may represent reference types such as objects or instances of a class. For example, in the following code: 4 Dim x As New MyClass Dim y As New MyClass( ) x = y If x Is y Then Perform (Z) [0023] Where Z represents code to continue program execution. In this case, “x Is y” evaluates to True, because both variables point to the same location in memory. In the example, x and y refer to the same instance of class MyClass. Hence, the program code represented by Z would be performed. [0024] Now consider the following code: 5 Dim x As New MyClass Dim y As New MyClass( ) If x Is y Then Perform (Z) [0025] In this case, “x Is y” evaluates to False, because although both variables are of the same class (that is, belong to the same class, MyClass), variable x points to another instance of the class than does y. [0026] Because the Is operator is often used to ensure that a variable has been initialized, the negation of the operator is often used to compare the variable to Nothing. In BASIC, Nothing is a keyword: the value of a variable that has not been initialized or set to point to a particular memory location evaluates to “Nothing”. Hence, the resulting language is often seen: 6 Sub Foo(ByRef x As ObjectType) If Not (x Is Nothing) Then Perform Z End If End Sub, [0027] which is to say, perform Z if x points to an object stored in memory. [0028] In accordance with one embodiment of the invention, the above statement “If Not (x Is Nothing)” which combines the use of two operators, “Is” and “Not”, may be replaced with a single operator. The keyword for the single operator may be “IsNot”, “is_not” or any other suitable keyword which reasonably conveys the concept of “is not”.

Exemplary Computing Environment [0029] FIG. 2 and the following discussion are intended to provide a brief general description of a suitable computing environment in which the invention may be implemented. It should be understood, however, that handheld, portable, and other computing devices of all kinds are contemplated for use in connection with the present invention. While a general purpose computer is described below, this is but one example, and the present invention requires only a thin client having network server interoperability and interaction. Thus, the present invention may be implemented in an environment of networked hosted services in which very little or minimal client resources are implicated, e.g., a networked environment in which the client device serves merely as a browser or interface to the World Wide Web. [0030] Although not required, the invention can be implemented via an application programming interface (API), for use by a developer, and/or included within the network browsing software which will be described in the general context of computer-executable instructions, such as program modules, being executed by one or more computers, such as client workstations, servers, or other devices. Generally, program modules include routines, programs, objects, components, data structures and the like that perform particular tasks or implement particular abstract data types. Typically, the functionality of the program modules may be combined or distributed as desired in various embodiments. Moreover, those skilled in the art will appreciate that the invention may be practiced with other computer system configurations. Other well known computing systems, environments, and/or configurations that may be suitable for use with the invention include, but are not limited to, personal computers (PCs), automated teller machines, server computers, hand-held or laptop devices, multi-processor systems, microprocessor-based systems, programmable consumer electronics, network PCs, minicomputers, mainframe computers, and the like. The invention may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network or other data transmission medium. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices. [0031] FIG. 2 thus illustrates an example of a suitable computing system environment 100 in which the invention may be implemented, although as made clear above, the computing system environment 100 is only one example of a suitable computing environment and is not intended to suggest any limitation as to the scope of use or functionality of the invention. Neither should the computing environment 100 be interpreted as having any dependency or requirement relating to any one or combination of components illustrated in the exemplary operating environment 100 . [0032] With reference to FIG. 2 , an exemplary system for implementing the invention includes a general purpose computing device in the form of a computer 110 . Components of computer 110 may include, but are not limited to, a processing unit 120 , a system memory 130 , and a system bus 121 that couples various system components including the system memory to the processing unit 120 . The system bus 121 may be any of several types of bus structures including a memory bus or memory controller, a peripheral bus, and a local bus using any of a variety of bus architectures. By way of example, and not limitation, such architectures include Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MCA) bus, Enhanced ISA (EISA) bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus (also known as Mezzanine bus). [0033] Computer 110 typically includes a variety of computer readable media. Computer readable media can be any available media that can be accessed by computer 110 and includes both volatile and nonvolatile media, removable and non-removable media. By way of example, and not limitation, computer readable media may comprise computer storage media and communication media. Computer storage media includes both volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CDROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can be accessed by computer 110 . Communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media. The term “modulated data signal” means a signal that has one or more of its characteristics set or changed in such a manner as to encode information in the signal. By way of example, and not limitation, communication media includes wired media such as a wired network or direct-wired connection, and wireless media such as acoustic, RF, infrared, and other wireless media. Combinations of any of the above should also be included within the scope of computer readable media. [0034] The system memory 130 includes computer storage media in the form of volatile and/or nonvolatile memory such as read only memory (ROM) 131 and random access memory (RAM) 132 . A basic input/output system 133 (BIOS), containing the basic routines that help to transfer information between elements within computer 110 , such as during start-up, is typically stored in ROM 131 . RAM 132 typically contains data and/or program modules that are immediately accessible to and/or presently being operated on by processing unit 120 . By way of example, and not limitation, FIG. 2 illustrates operating system 134 , application programs 135 , other program modules 136 , and program data 137 . [0035] The computer 110 may also include other removable/non-removable, volatile/nonvolatile computer storage media. By way of example only, FIG. 2 illustrates a hard disk drive 141 that reads from or writes to non-removable, nonvolatile magnetic media, a magnetic disk drive 151 that reads from or writes to a removable, nonvolatile magnetic disk 152 , and an optical disk drive 155 that reads from or writes to a removable, nonvolatile optical disk 156 , such as a CD ROM or other optical media. Other removable/non-removable, volatile/nonvolatile computer storage media that can be used in the exemplary operating environment include, but are not limited to, magnetic tape cassettes, flash memory cards, digital versatile disks, digital video tape, solid state RAM, solid state ROM, and the like. The hard disk drive 141 is typically connected to the system bus 121 through a non-removable memory interface such as interface 140 , and magnetic disk drive 151 and optical disk drive 155 are typically connected to the system bus 121 by a removable memory interface, such as interface 150 . [0036] The drives and their associated computer storage media discussed above and illustrated in FIG. 2 provide storage of computer readable instructions, data structures, program modules and other data for the computer 110 . In FIG. 2 , for example, hard disk drive 141 is illustrated as storing operating system 144 , application programs 145 , other program modules 146 , and program data 147 . Note that these components can either be the same as or different from operating system 134 , application programs 135 , other program modules 136 , and program data 137 . Operating system 144 , application programs 145 , other program modules 146 , and program data 147 are given different numbers here to illustrate that, at a minimum, they are different copies. A user may enter commands and information into the computer 110 through input devices such as a keyboard 162 and pointing device 161 , commonly referred to as a mouse, trackball or touch pad. Other input devices (not shown) may include a microphone, joystick, game pad, satellite dish, scanner, or the like. These and other input devices are often connected to the processing unit 120 through a user input interface 160 that is coupled to the system bus 121 , but may be connected by other interface and bus structures, such as a parallel port, game port or a universal serial bus (USB). [0037] A monitor 191 or other type of display device is also connected to the system bus 121 via an interface, such as a video interface 190 . A graphics interface 182 , such as Northbridge, may also be connected to the system bus 121 . Northbridge is a chipset that communicates with the CPU, or host processing unit 120 , and assumes responsibility for accelerated graphics port (AGP) communications. One or more graphics processing units (GPUs) 184 may communicate with graphics interface 182 . In this regard, GPUs 184 generally include on-chip memory storage, such as register storage and GPUs 184 communicate with a video memory 186 . GPUs 184 , however, are but one example of a coprocessor and thus a variety of coprocessing devices may be included in computer 110 . A monitor 191 or other type of display device is also connected to the system bus 121 via an interface, such as a video interface 190 , which may in turn communicate with video memory 186 . In addition to monitor 191 , computers may also include other peripheral output devices such as speakers 197 and printer 196 , which may be connected through an output peripheral interface 195 . [0038] The computer 110 may operate in a networked environment using logical connections to one or more remote computers, such as a remote computer 180 . The remote computer 180 may be a personal computer, a server, a router, a network PC, a peer device or other common network node, and typically includes many or all of the elements described above relative to the computer 110 , although only a memory storage device 181 has been illustrated in FIG. 2 . The logical connections depicted in FIG. 2 include a local area network (LAN) 171 and a wide area network (WAN) 173 , but may also include other networks. Such networking environments are commonplace in offices, enterprise-wide computer networks, intranets and the Internet. [0039] When used in a LAN networking environment, the computer 110 is connected to the LAN 171 through a network interface or adapter 170 . When used in a WAN networking environment, the computer 110 typically includes a modem 172 or other means for establishing communications over the WAN 173 , such as the Internet. The modem 172 , which may be internal or external, may be connected to the system bus 121 via the user input interface 160 , or other appropriate mechanism. In a networked environment, program modules depicted relative to the computer 110 , or portions thereof, may be stored in the remote memory storage device. By way of example, and not limitation, FIG. 2 illustrates remote application programs 185 as residing on memory device 181 . It will be appreciated that the network connections shown are exemplary and other means of establishing a communications link between the computers may be used. [0040] One of ordinary skill in the art can appreciate that a computer 110 or other client device can be deployed as part of a computer network. In this regard, the present invention pertains to any computer system having any number of memory or storage units, and any number of applications and processes occurring across any number of storage units or volumes. The present invention may apply to an environment with server computers and client computers deployed in a network environment, having remote or local storage. The present invention may also apply to a standalone computing device, having programming language functionality, interpretation and execution capabilities.