Although virtually all programming languages use variables to manage data, a handful are typeless, meaning that they don't require that you specify text, numbers, dates or other data types along with the variable's name. However, while this makes typeless languages easier to learn, it also makes maintaining and debugging programs more difficult.
Typed and Typeless Variables
Video of the Day
In a traditional, typed language, a programmer creates variables by specifying a name and the type of data the variable holds. For example, in COBOL, a variable to hold a customer name could be called "CUST-NAME." COBOL specifies data type with the "PICTURE" clause, and an alphabetical text data type is an "X." The whole specification might read, "05 CUST-NAME PICTURE X(30)" to set aside 30 characters of storage for the field. Other data types include integers, dates and numbers with floating decimal points. A typeless variable, by contrast, has only a name.
Video of the Day
Easier to Learn
A student picking up her first programming language may find a typeless one such as TCL easier to tackle than a traditional typed language such as Java. She does not have to spend time learning the differences between different types of data; the language automatically manages data types internally; and functions such as "expr" also determine what the program does with variables.
Lack of Clarity
Someone reading another person's program may have difficulty understanding a typeless language. Because the variables are not defined with a type, the use of variables for text and arithmetic becomes more ambiguous and potentially confusing. A programmer can mitigate this somewhat by including well-written comments to the code that describe how he uses the variables to accomplish a task. Better choices for variable names also make a difference; vague names such as "x," "cust1" or "d" convey less meaning than "customer_name," "total_sales" and "birthday."
Quicker Changes
Without the need to define and redefine types, programmers can make changes to existing code in less time. You can update a particular module or function without having to change variable definitions or other code that uses the same variables. In general, typeless languages have faster round trip times between changing code and seeing the change. This is an advantage for simple utility programs written on the fly to solve immediate problems, as well as bigger projects meant for long-term tasks.
Run-Time Errors
Although creating variables with data types is more work, it has the benefit of better reliability. The data types enforce rules that the language uses to flag potential errors. In a typed language, for example, you cannot multiply one text string by another; the language gives you a syntax error, forcing you to fix the mistake. In a typeless language, you can mistakenly assign text to variables meant for numbers, causing the running program to crash.