January 22, 2010

metasyntactic arguments

Computer programs have modular organization; modules interact by exchanging information.

There are two aspects of this, or rather the technical nomenclature used to refer to this, that I want to bring to your attention today, NeuroCooking friends.

The first is that the general term for the information passed from one module to another is "arguments". Isn't that odd? In real life, generally you supply either information or an argument. Here, the information is called an argument.

[In mathematical computing, the word "variable" is often used to refer to individual arguments.]

The second funny thing concerns the terminology for the placeholder names for such information. Let me explain with a math example. Suppose we write a software module to compute the power of one number raised to another:
function power( x , y )
; calculate value of x to the y power using natural logarithms
result = exp( y * ln(x) )
return, result
Information can be passed to this software module by invoking it using a "function call"; the calculated value is passed back (just as our function calls two others). For example, suppose, in another software module, we use the "power" function to calculate compound interest:
; compute compound interest given rate and term
value = inital_value * power( (1.0 + rate/100.) , term )
Notice that "x" and "y", the names of the arguments that appear in the program for, or definition of, the "power" function, do not appear here. Rather, "x" and "y" serve as placeholders for what actually gets passed. Now, the formal name for this is metasyntactic variable. That is, x & y are metasyntactic variables. The commonly used term though, is "dummy variable". As in, x & y are dummy variables. Isn't it odd that "dummy" can mean the same thing as such a fancy word as "metasyntactic"?

No comments:

Post a Comment


Blog Archive