A metasyntactic variable is a specific word or set of words identified as a placeholder in computer science and specifically computer programming . These words are commonly found in source code and are intended to be modified or substituted before real-world usage. For example, foo and bar are used in over 330 Internet Engineering Task Force Requests for Comments , the documents which define foundational internet technologies like HTTP (web), TCP/IP , and email protocols .
97-397: By mathematical analogy , a metasyntactic variable is a word that is a variable for other words, just as in algebra letters are used as variables for numbers . Metasyntactic variables are used to name entities such as variables, functions, and commands whose exact identity is unimportant and serve only to demonstrate a concept, which is useful for teaching programming. Since English
194-556: A closure . Unless the programming language features garbage collection , a variable whose extent permanently outlasts its scope can result in a memory leak , whereby the memory allocated for the variable can never be freed since the variable which would be used to reference it for deallocation purposes is no longer accessible. However, it can be permissible for a variable binding to extend beyond its scope, as occurs in Lisp closures and C static local variables ; when execution passes back into
291-429: A variable is an abstract storage location paired with an associated symbolic name , which contains some known or unknown quantity of data or object referred to as a value ; or in simpler terms, a variable is a named container for a particular set of bits or type of data (like integer , float , string , etc...). A variable can eventually be associated with or identified by a memory address . The variable name
388-532: A certain function/ subroutine , or more finely within a block of expressions/statements (accordingly with function scope or block scope ); this is static resolution, performable at parse-time or compile-time. Alternatively, a variable with dynamic scope is resolved at run-time, based on a global binding stack that depends on the specific control flow . Variables only accessible within a certain functions are termed " local variables ". A " global variable ", or one with indefinite scope, may be referred to anywhere in
485-416: A child may spontaneously engage in comparison and learn an abstract relationship, without the need for prompts. Comparison is more likely when the objects to be compared are close together in space and/or time, are highly similar (although not so similar that they match, which interfere with identifying relationships), or share common labels. In law , analogy is a method of resolving issues on which there
582-515: A circuit. In a circuit, the electricity is carried through wires and the current, or rate of flow of electricity, is determined by the voltage, or electrical pressure. Given the similarity in structure, or structural alignment, between these domains, structure mapping theory would predict that relationships from one of these domains, would be inferred in the other using analogy. Children do not always need prompting to make comparisons in order to learn abstract relationships. Eventually, children undergo
679-419: A conclusion about the analogy and comparing the new material with the already learned material. Typically this method is used to learn topics in science. In 1989, teacher Kerry Ruef began a program titled The Private Eye Project . It is a method of teaching that revolves around using analogies in the classroom to better explain topics. She thought of the idea to use analogies as a part of curriculum because she
776-458: A datatype may be associated only with the current value, allowing a single variable to store anything supported by the programming language. Variables are the containers for storing the values. Variables and scope: An identifier referencing a variable can be used to access the variable in order to read out the value, or alter the value, or edit other attributes of the variable, such as access permission, locks , semaphores , etc. For instance,
873-432: A domain is viewed as consisting of objects, their properties, and the relationships that characterise their interactions. The process of analogy then involves: In general, it has been found that people prefer analogies where the two systems correspond highly to each other (e.g. have similar relationships across the domains as opposed to just having similar objects across domains) when these people try to compare and contrast
970-397: A function named length may determine the length of a list. Such a length function may be parametric polymorphic by including a type variable in its type signature , since the number of elements in the list is independent of the elements' types. The formal parameters (or formal arguments ) of functions are also referred to as variables. For instance, in this Python code segment,
1067-504: A functor f from C to D can be thought of as an analogy between C and D, because f has to map objects of C to objects of D and arrows of C to arrows of D in such a way that the structure of their respective parts is preserved. This is similar to the structure mapping theory of analogy of Dedre Gentner, because it formalises the idea of analogy as a function which makes certain conditions true. A computer algorithm has achieved human-level performance on multiple-choice analogy questions from
SECTION 10
#17328699459581164-418: A given program. The scope of a variable is the portion of the program's text for which the variable's name has meaning and for which the variable is said to be "visible". Entrance into that scope typically begins a variable's lifetime (as it comes into context) and exit from that scope typically ends its lifetime (as it goes out of context). For instance, a variable with " lexical scope " is meaningful only within
1261-452: A precise naming scheme. Shorter names are faster to type but are less descriptive; longer names often make programs easier to read and the purpose of variables easier to understand. However, extreme verbosity in variable names can also lead to less comprehensible code. We can classify variables based on their lifetime. The different types of variables are static, stack-dynamic, explicit heap-dynamic, and implicit heap-dynamic. A static variable
1358-562: A program do not accidentally interact with each other by modifying each other's variables. Doing so also prevents action at a distance . Common techniques for doing so are to have different sections of a program use different name spaces , or to make individual variables "private" through either dynamic variable scoping or lexical variable scoping . Many programming languages employ a reserved value (often named null or nil ) to indicate an invalid or uninitialized variable. In statically typed languages such as C , C++ , Java or C# ,
1455-408: A program, so @code is correct for them.") Another point reflected in the above example is the convention that a metavariable is to be uniformly substituted with the same instance in all its appearances in a given schema. This is in contrast with nonterminal symbols in formal grammars where the nonterminals on the right of a production can be substituted by different instances. It is common to use
1552-460: A programming language being documented in some texinfo file as: "Use the @var command to indicate metasyntactic variables. A metasyntactic variable is something that stands for another piece of text. For example, you should use a metasyntactic variable in the documentation of a function to describe the arguments that are passed to that function. Do not use @var for the names of particular variables in programming languages. These are specific names from
1649-497: A relational shift, after which they begin seeing similar relations across different situations instead of merely looking at matching objects. This is critical in their cognitive development as continuing to focus on specific objects would reduce children's ability to learn abstract patterns and reason analogically. Interestingly, some researchers have proposed that children's basic brain functions (i.e., working memory and inhibitory control) do not drive this relational shift. Instead, it
1746-548: A renewed interest in analogy, most notably in cognitive science . Cajetan named several kinds of analogy that had been used but previously unnamed, particularly: In ancient Greek the word αναλογια ( analogia ) originally meant proportionality , in the mathematical sense, and it was indeed sometimes translated to Latin as proportio . Analogy was understood as identity of relation between any two ordered pairs , whether of mathematical nature or not. Analogy and abstraction are different cognitive processes, and analogy
1843-425: A significant role in problem solving , as well as decision making , argumentation , perception , generalization , memory , creativity , invention , prediction, emotion , explanation , conceptualization and communication . It lies behind basic tasks such as the identification of places, objects and people, for example, in face perception and facial recognition systems . Hofstadter has argued that analogy
1940-414: A single identifier, that identifier can simply be called the name of the variable ; otherwise, we can speak of it as one of the names of the variable . For instance, in the previous example the identifier " total_count " is the name of the variable in question, and " r " is another name of the same variable. The scope of a variable describes where in a program's text the variable may be used, while
2037-422: A single value during their entire lifetime due to the requirements of referential transparency . In imperative languages, the same behavior is exhibited by (named) constants (symbolic constants), which are typically contrasted with (normal) variables. Depending on the type system of a programming language, variables may only be able to store a specified data type (e.g. integer or string ). Alternatively,
SECTION 20
#17328699459582134-597: A situation known as aliasing . Assigning a value to the variable using one of the identifiers will change the value that can be accessed through the other identifiers. Compilers have to replace variables' symbolic names with the actual locations of the data. While a variable's name, type, and location often remain fixed, the data stored in the location may be changed during program execution. In imperative programming languages , values can generally be accessed or changed at any time. In pure functional and logic languages , variables are bound to expressions and keep
2231-461: A special case of induction . In their view analogy is an inductive inference from common known attributes to another probable common attribute, which is known about only in the source of the analogy, in the following form: Contemporary cognitive scientists use a wide notion of analogy, extensionally close to that of Plato and Aristotle, but framed by Gentner's (1983) structure-mapping theory . The same idea of mapping between source and target
2328-419: A teacher may refer to other concepts, items or phenomena that pupils are more familiar with. It may help to create or clarify one theory (or theoretical model) via the workings of another theory (or theoretical model). Thus an analogy, as used in teaching, would be comparing a topic that students are already familiar with, with a new topic that is being introduced, so that students can get a better understanding of
2425-415: A variable also has a type , meaning that only certain kinds of values can be stored in it. For example, a variable of type " integer " is prohibited from storing text values. In dynamically typed languages such as Python , a variable's type is inferred by its value, and can change according to its value. In Common Lisp , both situations exist simultaneously: A variable is given a type (if undeclared, it
2522-408: A variable might be referenced by the identifier " total_count " and the variable can contain the number 1956. If the same variable is referenced by the identifier " r " as well, and if using this identifier " r ", the value of the variable is altered to 2009, then reading the value using the identifier " total_count " will yield a result of 2009 and not 1956. If a variable is only referenced by
2619-485: A very important part in morality . This may be because morality is supposed to be impartial and fair. If it is wrong to do something in a situation A, and situation B corresponds to A in all related features, then it is also wrong to perform that action in situation B. Moral particularism accepts such reasoning, instead of deduction and induction, since only the first can be used regardless of any moral principles. Structure mapping, originally proposed by Dedre Gentner ,
2716-590: A wider notion of analogy. They saw analogy as a shared abstraction. Analogous objects did not share necessarily a relation, but also an idea, a pattern, a regularity, an attribute, an effect or a philosophy. These authors also accepted that comparisons, metaphors and "images" (allegories) could be used as arguments , and sometimes they called them analogies . Analogies should also make those abstractions easier to understand and give confidence to those who use them. James Francis Ross in Portraying Analogy (1982),
2813-410: Is "the core of cognition". An analogy is not a figure of speech but a kind of thought. Specific analogical language uses exemplification , comparisons , metaphors , similes , allegories , and parables , but not metonymy . Phrases like and so on , and the like , as if , and the very word like also rely on an analogical understanding by the receiver of a message including them. Analogy
2910-420: Is a comparison or correspondence between two things (or two groups of things) because of a third element that they are considered to share. In logic, it is an inference or an argument from one particular to another particular, as opposed to deduction , induction , and abduction . It is also used of where at least one of the premises , or the conclusion, is general rather than particular in nature. It has
3007-402: Is a property of the program, and varies by point in the program's text or execution—see scope: an overview . Further, object lifetime may coincide with variable lifetime, but in many cases is not tied to it. Scope is an important part of the name resolution of a variable. Most languages define a specific scope for each variable (as well as any other named entity), which may differ within
Metasyntactic variable - Misplaced Pages Continue
3104-462: Is a theory in psychology that describes the psychological processes involved in reasoning through, and learning from, analogies. More specifically, this theory aims to describe how familiar knowledge, or knowledge about a base domain, can be used to inform an individual's understanding of a less familiar idea, or a target domain. According to this theory, individuals view their knowledge of ideas, or domains, as interconnected structures. In other words,
3201-583: Is also known as global variable, it is bound to a memory cell before execution begins and remains to the same memory cell until termination. A typical example is the static variables in C and C++. A Stack-dynamic variable is known as local variable, which is bound when the declaration statement is executed, and it is deallocated when the procedure returns. The main examples are local variables in C subprograms and Java methods. Explicit Heap-Dynamic variables are nameless (abstract) memory cells that are allocated and deallocated by explicit run-time instructions specified by
3298-446: Is an abstraction, an idea; in implementation, a value is represented by some data object , which is stored somewhere in computer memory. The program, or the runtime environment , must set aside memory for each data object and, since memory is finite, ensure that this memory is yielded for reuse when the object is no longer needed to represent some variable's value. Objects allocated from the heap must be reclaimed—especially when
3395-443: Is assumed to be T , the universal supertype ) which exists at compile time. Values also have types, which can be checked and queried at runtime. Typing of variables also allows polymorphisms to be resolved at compile time. However, this is different from the polymorphism used in object-oriented function calls (referred to as virtual functions in C++ ) which resolves the call based on
3492-480: Is called a heuristic function of analogical reasoning. Analogical arguments can also be probative, meaning that they serve as a means of proving the rightness of particular theses and theories. This application of analogical reasoning in science is debatable. Analogy can help prove important theories, especially in those kinds of science in which logical or empirical proof is not possible such as theology , philosophy or cosmology when it relates to those areas of
3589-409: Is driven by their relational knowledge, such as having labels for the objects that make the relationships clearer(see previous section). However, there is not enough evidence to determine whether the relational shift is actually because basic brain functions become better or relational knowledge becomes deeper. Additionally, research has identified several factors that may increase the likelihood that
3686-417: Is high-level perception. Forbus et al. (1998) claim that this is only a metaphor. It has been argued (Morrison and Dietrich 1995) that Hofstadter's and Gentner's groups do not defend opposite views, but are instead dealing with different aspects of analogy. In anatomy , two anatomical structures are considered to be analogous when they serve similar functions but are not evolutionarily related, such as
3783-447: Is important not only in ordinary language and common sense (where proverbs and idioms give many examples of its application) but also in science , philosophy , law and the humanities . The concepts of association , comparison, correspondence, mathematical and morphological homology , homomorphism , iconicity , isomorphism , metaphor, resemblance, and similarity are closely related to analogy. In cognitive linguistics ,
3880-457: Is no clear line between perception , including high-level perception, and analogical thinking. In fact, analogy occurs not only after, but also before and at the same time as high-level perception. In high-level perception, humans make representations by selecting relevant information from low-level stimuli . Perception is necessary for analogy, but analogy is also necessary for high-level perception. Chalmers et al. concludes that analogy actually
3977-433: Is no previous authority. The legal use of analogy is distinguished by the need to use a legally relevant basis for drawing an analogy between two situations. It may be applied to various forms of legal authority , including statutory law and case law . In the civil law tradition, analogy is most typically used for filling gaps in a statutory scheme. In the common law tradition, it is most typically used for extending
Metasyntactic variable - Misplaced Pages Continue
4074-401: Is not apparent in some lexical definitions of palm and sole , where the former is defined as the inner surface of the hand , and the latter as the underside of the foot . Kant's Critique of Judgment held to this notion of analogy, arguing that there can be exactly the same relation between two completely different objects. Greek philosophers such as Plato and Aristotle used
4171-402: Is now used by thousands of schools around the country. The Fourth Lateran Council of 1215 taught: For between creator and creature there can be noted no similarity so great that a greater dissimilarity cannot be seen between them. The theological exploration of this subject is called the analogia entis . The consequence of this theory is that all true statements concerning God (excluding
4268-561: Is often (though not always) a similarity , as in the biological notion of analogy . Analogy plays a significant role in human thought processes. It has been argued that analogy lies at "the core of cognition". The English word analogy derives from the Latin analogia , itself derived from the Greek ἀναλογία , "proportion", from ana- "upon, according to" [also "again", "anew"] + logos "ratio" [also "word, speech, reckoning"]. Analogy plays
4365-481: Is often an easier one. This analogy is not comparing all the properties between a hand and a foot, but rather comparing the relationship between a hand and its palm to a foot and its sole. While a hand and a foot have many dissimilarities, the analogy focuses on their similarity in having an inner surface. The same notion of analogy was used in the US -based SAT college admission tests, that included "analogy questions" in
4462-573: Is the analogue ear based on electrical, electronic or mechanical devices. Some types of analogies can have a precise mathematical formulation through the concept of isomorphism . In detail, this means that if two mathematical structures are of the same type, an analogy between them can be thought of as a bijection which preserves some or all of the relevant structure. For example, R 2 {\displaystyle \mathbb {R} ^{2}} and C {\displaystyle \mathbb {C} } are isomorphic as vector spaces, but
4559-657: Is the foundation language or lingua franca of most computer programming languages, variables that originate in English are commonly seen even in programs and examples of programs written for other spoken-language audiences. The variables used in a particular context may depend on subcultures that develop around programming languages . Metasyntactic variables used commonly across all programming languages include foobar , foo , bar , baz , qux , quux , corge , grault , garply , waldo , fred , plugh , xyzzy , and thud . Two of these words, plugh and xyzzy , are taken from
4656-479: Is the usual way to reference the stored value, in addition to referring to the variable itself, depending on the context. This separation of name and content allows the name to be used independently of the exact information it represents. The identifier in computer source code can be bound to a value during run time , and the value of the variable may thus change during the course of program execution . Variables in programming may not directly correspond to
4753-422: Is to and as when representing the analogous relationship between two pairs of expressions, for example, "Smile is to mouth, as wink is to eye." In the field of mathematics and logic, this can be formalized with colon notation to represent the relationships, using single colon for ratio, and double colon for equality. In the field of testing, the colon notation of ratios and equality is often borrowed, so that
4850-400: Is used by conceptual metaphor and conceptual blending theorists. Structure mapping theory concerns both psychology and computer science . According to this view, analogy depends on the mapping or alignment of the elements of source and target. The mapping takes place not only between objects, but also between relations of objects and between relations of relations. The whole mapping yields
4947-542: The IETF RFCs and computer programming languages are rendered in plain text , making it necessary to distinguish metasyntactic variables by a naming convention, since it would not be obvious from context. Here is an example from the official IETF document explaining the e-mail protocols (from RFC 772 - cited in RFC 3092): (The documentation for texinfo emphasizes the distinction between metavariables and mere variables used in
SECTION 50
#17328699459585044-449: The MONIAC (an analogue computer ) used the flow of water in its pipes as an analogue to the flow of money in an economy. Where two or more biological or physical participants meet, they communicate and the stresses produced describe internal models of the participants. Pask in his conversation theory asserts an analogy that describes both similarities and differences between any pair of
5141-669: The SAT test. The algorithm measures the similarity of relations between pairs of words (e.g., the similarity between the pairs HAND:PALM and FOOT:SOLE) by statistically analysing a large collection of text. It answers SAT questions by selecting the choice with the highest relational similarity. The analogical reasoning in the human mind is free of the false inferences plaguing conventional artificial intelligence models, (called systematicity ). Steven Phillips and William H. Wilson use category theory to mathematically demonstrate how such reasoning could arise naturally by using relationships between
5238-430: The complex numbers , C {\displaystyle \mathbb {C} } , have more structure than R 2 {\displaystyle \mathbb {R} ^{2}} does: C {\displaystyle \mathbb {C} } is a field as well as a vector space . Category theory takes the idea of mathematical analogy much further with the concept of functors . Given two categories C and D,
5335-399: The extent (also called lifetime ) of a variable describes when in a program's execution the variable has a (meaningful) value. The scope of a variable affects its extent. The scope of a variable is actually a property of the name of the variable, and the extent is a property of the storage location of the variable. These should not be confused with context (also called environment ), which
5432-507: The function overloading capabilities of the C++ language Spam , ham , and eggs are the principal metasyntactic variables used in the Python programming language . This is a reference to the famous comedy sketch, " Spam ", by Monty Python , the eponym of the language. In the following example spam , ham , and eggs are metasyntactic variables and lines beginning with # are comments. Both
5529-450: The legs of vertebrates and the legs of insects . Analogous structures are the result of independent evolution and should be contrasted with structures which shared an evolutionary line. Often a physical prototype is built to model and represent some other physical object. For example, wind tunnels are used to test scale models of wings and aircraft which are analogous to (correspond to) full-size wings and aircraft. For example,
5626-519: The " coherence " of an analogy depends on structural consistency, semantic similarity and purpose. Structural consistency is the highest when the analogy is an isomorphism , although lower levels can be used as well. Similarity demands that the mapping connects similar elements and relationships between source and target, at any level of abstraction. It is the highest when there are identical relations and when connected elements have many identical attributes. An analogy achieves its purpose if it helps solve
5723-601: The 90's like LeMan. The words do not mean anything, and are used for precisely that reason. The terms were popularized more widely by the actor and stand-up comedian Cem Yılmaz in the late 90's and early 2000's. In Italian software programming culture, it is common to encounter names of Walt Disney characters (as found in the Italian versions of the shows) being used as variables. These names often appear in pseudo-code, are referenced in software engineering classes, and are commonly employed when explaining algorithms to colleagues. Among
5820-454: The University of Georgia, developed a theory on teaching with analogies and developed steps to explain the process of teaching with this method. The steps for teaching with analogies are as follows: Step one is introducing the new topic that is about to be taught and giving some general knowledge on the subject. Step two is reviewing the concept that the students already know to ensure they have
5917-442: The address of some particular block (contiguous sequence) of bytes in memory, and operations on the variable manipulate that block. Referencing is more common for variables whose values have large or unknown sizes when the code is compiled. Such variables reference the location of the value instead of storing the value itself, which is allocated from a pool of memory called the heap . Bound variables have values. A value, however,
SECTION 60
#17328699459586014-457: The assignment of a predicate or a relation to the target. Structure mapping theory has been applied and has found considerable confirmation in psychology . It has had reasonable success in computer science and artificial intelligence (see below). Some studies extended the approach to specific subjects, such as metaphor and similarity. Logicians analyze how analogical reasoning is used in arguments from analogy . An analogy can be stated using
6111-400: The base analogue is selected and mapping from base to target occurs in series. Empirical evidence shows that humans are better at using and creating analogies when the information is presented in an order where an item and its analogue are placed together.. Eqaan Doug and his team challenged the shared structure theory and mostly its applications in computer science. They argue that there
6208-615: The basic restrictions imposed by a language, the naming of variables is largely a matter of style. At the machine code level, variable names are not used, so the exact names chosen do not matter to the computer. Thus names of variables identify them, for the rest they are just a tool for programmers to make programs easier to write and understand. Using poorly chosen variable names can make code more difficult to review than non-descriptive names, so names that are clear are often encouraged. Programmers often create and adhere to code style guidelines that offer guidance on naming variables or impose
6305-570: The concept of variables in mathematics . The latter is abstract , having no reference to a physical object such as storage location. The value of a computing variable is not necessarily part of an equation or formula as in mathematics. Variables in computer programming are frequently given long names to make them relatively descriptive of their use, whereas variables in mathematics often have terse, one- or two-character names for brevity in transcription and manipulation. A variable's storage location may be referenced by several different identifiers,
6402-485: The concrete details of Jesus' earthly life) are rough analogies, without implying any falsehood. Such analogical and true statements would include God is , God is Love , God is a consuming fire , God is near to all who call him , or God as Trinity, where being , love , fire , distance , number must be classed as analogies that allow human cognition of what is infinitely beyond positive or negative language. Variable (programming) In computer programming ,
6499-617: The cosmos (the universe) that are beyond any data-based observation and knowledge about them stems from the human insight and thinking outside the senses. Analogy can be used in theoretical and applied sciences in the form of models or simulations which can be considered as strong indications of probable correctness. Other, much weaker, analogies may also assist in understanding and describing nuanced or key functional behaviours of systems that are otherwise difficult to grasp or prove. For instance, an analogy used in physics textbooks compares electrical circuits to hydraulic circuits. Another example
6596-466: The example above might be rendered, "Smile : mouth :: wink : eye" and pronounced the same way. Analogy is also a term used in the Neogrammarian school of thought as a catch-all to describe any morphological change in a language that cannot be explained merely sound change or borrowing. Analogies are mainly used as a means of creating new ideas and hypotheses, or testing them, which
6693-406: The first substantive examination of the topic since Cajetan's De Nominum Analogia , demonstrated that analogy is a systematic and universal feature of natural languages, with identifiable and law-like characteristics which explain how the meanings of words in a sentence are interdependent. On the contrary, Ibn Taymiyya , Francis Bacon and later John Stuart Mill argued that analogy is simply
6790-537: The form "A is to B as C is to what ?" For example, "Hand is to palm as foot is to ____?" These questions were usually given in the Aristotelian format: HAND : PALM : : FOOT : ____ While most competent English speakers will immediately give the right answer to the analogy question ( sole ), it is more difficult to identify and describe the exact relation that holds both between pairs such as hand and palm , and between foot and sole . This relation
6887-479: The game Colossal Cave Adventure . A fuller reference can be found in The Hacker's Dictionary from MIT Press . In Japanese, the words hoge (ほげ) and fuga (ふが) are commonly used, with other common words and variants being piyo (ぴよ), hogera (ほげら), and hogehoge (ほげほげ). The origin of hoge as a metasyntactic variable is not known, but it is believed to date to the early 1980s. In France,
6984-403: The general form A is to B as C is to D . In a broader sense, analogical reasoning is a cognitive process of transferring some information or meaning of a particular subject (the analog, or source) onto another (the target); and also the linguistic expression corresponding to such a process. The term analogy can also refer to the relation between the source and the target themselves, which
7081-405: The heap is depleted as the program runs, risks eventual failure from exhausting available memory. When a variable refers to a data structure created dynamically, some of its components may be only indirectly accessed through the variable. In such circumstances, garbage collectors (or analogous program features in languages that lack garbage collectors) must deal with a case where only a portion of
7178-449: The internal arrows that keep the internal structures of the categories rather than the mere relationships between the objects (called "representational states"). Thus, the mind, and more intelligent AIs, may use analogies between domains whose internal structures transform naturally and reject those that do not. Keith Holyoak and Paul Thagard (1997) developed their multiconstraint theory within structure mapping theory. They defend that
7275-495: The language syntax which involves the format of valid identifiers. In almost all languages, variable names cannot start with a digit (0–9) and cannot contain whitespace characters. Whether or not punctuation marks are permitted in variable names varies from language to language; many languages only permit the underscore ("_") in variable names and forbid all other punctuation. In some programming languages, sigils (symbols or punctuation) are affixed to variable identifiers to indicate
7372-418: The memory reachable from the variable needs to be reclaimed. Unlike their mathematical counterparts, programming variables and constants commonly take multiple-character names, e.g. COST or total . Single-character names are most commonly used only for auxiliary variables; for instance, i , j , k for array index variables. Some naming conventions are enforced at the language level as part of
7469-580: The most frequently used are "pippo" (Goofy), "pluto," and "paperino" (Donald Duck). In German software programming culture, it is common to encounter the personal name Klaus as a placeholder name for a class; it sounds similar to "Klasse", the German word for "class". In the following example the function name foo and the variable name bar are both metasyntactic variables. Lines beginning with // are comments. Function prototypes with examples of different argument passing mechanisms: Example showing
7566-481: The name ACME in example SQL databases and as a placeholder company-name for the purpose of teaching. The term 'ACME Database' is commonly used to mean a training or example-only set of database data used solely for training or testing. ACME is also commonly used in documentation which shows SQL usage examples, a common practice with in many educational texts as well as technical documentation from companies such as Microsoft and Oracle . Analogy Analogy
7663-413: The new topic by relating back to existing knowledge. This can be particularly helpful when the analogy serves across different disciplines: indeed, there are various teaching innovations now emerging that use sight-based analogies for teaching and research across subjects such as science and the humanities. Shawn Glynn, a professor in the department of educational psychology and instructional technology at
7760-449: The notion of conceptual metaphor may be equivalent to that of analogy. Analogy is also a basis for any comparative arguments as well as experiments whose results are transmitted to objects that have been not under examination (e.g., experiments on rats when results are applied to humans). Analogy has been studied and discussed since classical antiquity by philosophers, scientists, theologists and lawyers . The last few decades have shown
7857-439: The objects are no longer needed. In a garbage-collected language (such as C# , Java , Python, Golang and Lisp ), the runtime environment automatically reclaims objects when extant variables can no longer refer to them. In non-garbage-collected languages, such as C , the program (and the programmer) must explicitly allocate memory, and then later free it, to reclaim its memory. Failure to do so leads to memory leaks , in which
7954-430: The participants' internal models or concepts exists. In historical science, comparative historical analysis often uses the concept of analogy and analogical reasoning. Recent methods involving calculation operate on large document archives, allowing for analogical or corresponding terms from the past to be found as a response to random questions by users (e.g., Myanmar - Burma) and explained. Analogical reasoning plays
8051-404: The previous two cases may be said to be out of extent or unbound . In many languages, it is an error to try to use the value of a variable when it is out of extent. In other languages, doing so may yield unpredictable results . Such a variable may, however, be assigned a new value, which gives it a new extent. For space efficiency, a memory space needed for a variable may be allocated only when
8148-509: The problem at hand. The multiconstraint theory faces some difficulties when there are multiple sources, but these can be overcome. Hummel and Holyoak (2005) recast the multiconstraint theory within a neural network architecture. A problem for the multiconstraint theory arises from its concept of similarity, which, in this respect, is not obviously different from analogy itself. Computer applications demand that there are some identical attributes or relations at some level of abstraction. The model
8245-407: The program. Extent , on the other hand, is a runtime ( dynamic ) aspect of a variable. Each binding of a variable to a value can have its own extent at runtime. The extent of the binding is the portion of the program's execution time during which the variable continues to refer to the same value or memory location. A running program may enter and leave a given extent many times, as in the case of
8342-403: The proper knowledge to assess the similarities between the two concepts. Step three is finding relevant features within the analogy of the two concepts. Step four is finding similarities between the two concepts so students are able to compare and contrast them in order to understand. Step five is indicating where the analogy breaks down between the two concepts. And finally, step six is drawing
8439-409: The representation of their values vary widely, both among programming languages and among implementations of a given language. Many language implementations allocate space for local variables , whose extent lasts for a single function call on the call stack , and whose memory is automatically reclaimed when the function returns. More generally, in name binding , the name of a variable is bound to
8536-434: The scope of precedent . The use of analogy in both traditions is broadly described by the traditional maxim Ubi eadem est ratio, ibi idem ius (where the reason is the same, the law is the same). Analogies as defined in rhetoric are a comparison between words, but an analogy more generally can also be used to illustrate and teach. To enlighten pupils on the relations between or within certain concepts, items or phenomena,
8633-476: The systems. This is also known as the systematicity principle. An example that has been used to illustrate structure mapping theory comes from Gentner and Gentner (1983) and uses the base domain of flowing water and the target domain of electricity. In a system of flowing water, the water is carried through pipes and the rate of water flow is determined by the pressure of the water towers or hills. This relationship corresponds to that of electricity flowing through
8730-404: The value type as opposed to the supertypes the variable is allowed to have. Variables often store simple data, like integers and literal strings, but some programming languages allow a variable to store values of other datatypes as well. Such languages may also enable functions to be parametric polymorphic . These functions operate like variables to represent data of multiple types. For example,
8827-436: The variable is first used and freed when it is no longer needed. A variable is only needed when it is in scope, thus beginning each variable's lifetime when it enters scope may give space to unused variables. To avoid wasting such space, compilers often warn programmers if a variable is declared but not used. It is considered good programming practice to make the scope of variables as narrow as feasible so that different parts of
8924-424: The variable named x is a parameter because it is given a value when the function is called. The integer 5 is the argument which gives x its value. In most languages, function parameters have local scope. This specific variable named x can only be referred to within the addtwo function (though of course other functions can also have variables called x ). The specifics of variable allocation and
9021-452: The variable's datatype or scope. Case-sensitivity of variable names also varies between languages and some languages require the use of a certain case in naming certain entities; Most modern languages are case-sensitive; some older languages are not. Some languages reserve certain forms of variable names for their own internal use; in many languages, names beginning with two underscores ("__") often fall under this category. However, beyond
9118-453: The variable's scope, the variable may once again be used. A variable whose scope begins before its extent does is said to be uninitialized and often has an undefined, arbitrary value if accessed (see wild pointer ), since it has yet to be explicitly given a particular value. A variable whose extent ends before its scope may become a dangling pointer and deemed uninitialized once more since its value has been destroyed. Variables described by
9215-439: The word toto is widely used, with variants tata , titi , tutu as related placeholders. One commonly-raised source for the use of toto is a reference to the stock character used to tell jokes with Tête à Toto . In Turkey, the words hede and hödö (usually spelt hodo due to ASCII -only naming constraints of programming languages) are well-known metasyntactic variables that stem from popular humorous cartoon magazines of
9312-400: Was extended (Doumas, Hummel, and Sandhofer, 2008) to learn relations from unstructured examples (providing the only current account of how symbolic representations can be learned from examples). Mark Keane and Brayshaw (1988) developed their Incremental Analogy Machine (IAM) to include working memory constraints as well as structural, semantic and pragmatic constraints, so that a subset of
9409-605: Was observing objects once and she said, "my mind was noting what else each object reminded me of..." This led her to teach with the question, "what does [the subject or topic] remind you of?" The idea of comparing subjects and concepts led to the development of The Private Eye Project as a method of teaching. The program is designed to build critical thinking skills with analogies as one of the main themes revolving around it. While Glynn focuses on using analogies to teach science, The Private Eye Project can be used for any subject including writing, math, art, social studies, and invention. It
#957042