| • Science | • People | • Locations | • Timeline |
In "normal" programming systems the program is represented by a series of text files known as source code. The source code is collected together by a program known as a compiler (an interpreter can be used in many cases), which creates an object code, which then can be linked to a running computer program. In a gross sense, the source code captures the intentions of the programmer, but does so at a very low level.
For instance, let's say you wanted to write a program to write out the numbers from 1 to 10. Using a Java-like syntax, such a program could be written like this:
The code above contains one of the more common constructs of most computer languages, the bounded loop , in this case represented by the for construct. The code, when compiled, linked and run, will loop 10 times, incrementing the value of i each time and then printing it out.
However this code does not truly capture the intentions of the programmer, which was, simply, "print the numbers 1 to 10". If you were asked to maintain this code you could likely figure out what it is trying to do, but this is not always the case.
In intentional programming systems the above loop would indeed be represented, at some level, as "print the numbers 1 to 10". The system would then use the intentions to generate source code, likely something very similar to the code above. The key difference is that the source code has lost the semantic level that the intentional programming systems maintain, and in larger programs this can dramatically ease readability.
Key to IP is the concept of identity. In the code above you will see the object i, which in this case is an "index" in a loop. In larger programs the symbol i may be used numerous times, and not always for the same task. For instance, consider this code:
This is perfectly valid, if somewhat poorly written, code. The meaning of i varies, at the top and bottom it refers to the String object holding the value "am canadian", while in the loop it refers to the integerThe integers consist of the positive natural numbers (1, 2, 3, …) the negative natural numbers (−1, −2, −3,. and the number zero. The set of all integers is usually denoted in mathematics by Z (or Z in blackboard bold, ), which st value index as before. The identity of "i" varies, a common feature of most programming languageAn alternate rewrite has been has been. Please refer to it for large rewrites. A programming language or computer language is a standardized communication technique for expressing instructions to a computer. It is a set of syntactic and semantic rules uses, which define identity based on the file the symbol is in, the " scopeThis article is about the use of the term in computer science. See scope for other uses. In computer programming, the scope of an identifier refers to where and when in the program the identifier can be referenced. Scope applies to all identifiers in a pr", and various other rules. In code that spans several pages, it can become very difficult to tell what symbolA symbol or (in many senses) token is a representation of something — an idea, object, concept, quality, etc. Nature of symbols A symbol can be a material object whose shape or origin is related, by nature or convention, to the thing it represents: for in refers to what actual object. If you decide to change the name of one, you have to carefully examine the codeFor other senses of the word "code", see code (disambiguation). In communications, a code is a rule for converting a piece of information (for example, a letter, word, or phrase) into another form or representation, not necessarily of the same sort. In co to see where it is being used.
ERROR. This code will not compile--you cannot bind the same name twice in the same scope in
Java, C, or any other similar language. If you use a dynamic language like
Python:
"i" will be rebound to 1 through 10, and at the end will print 10 again. No amount of scoping in the same method will change this. The only way to get Simonyi's result is to put the for loop in an entirely separate method. In any modern language, the conflict never even emerges; only in primitive languages making extensive use of undeclared global variables (BASIC) would the redefinition ever be a problem.
In an IP system, both of the "i"'s above would be represented by a separate, private identifierIdentifiers IDs are used in computer science, data processing, and general telecommunications; the concept is analogous to that of a " name". Computer Science In computer science, an identifier is a string of bits (or characters) which name an entity, suc. The IP system would track each, and could tell you at any time what object refers to what definitionFor alternative meanings see definition (disambiguation A definition may be a statement of the essential properties of a certain thing, or a statement of equivalence between a term and that term's meaning. The two are not mutually exclusive, nor are they. If you decided to rename one, say the poorly named String, IP "knows" all of the uses of that identifier and could change them all to "myString" without problems.
IP systems also offer several levels of detail, allowing the programmer to "zoom in" or out. In the example above, the programmer could zoom out to get a level that would say something like: