[net.lang] Interpretation of Unadorned Identifiers

jack@rlgvax.UUCP (Jack Waugh) (09/09/84)

An interesting basis on which to compare some programming languages
is to ask how each interprets an unadorned identifier.  For example,
Logo treats an unadorned itentifier as a function call.  If I
remember correctly, Lisp treats one as a self-quoting constant.
So does UNIX shell.
Lisp example:
	(foo bar (bletch))
Equivalent Logo:
	foo "bar bletch
Equivalent Bourne Shell:
	foo bar `bletch`
In each example, the interpretation is to call bletch, then call
foo with "bar" as its first argument, and the value returned from
bletch is its second.  In the shell example, "foo" isn't unadorned;
it follows a semantically significant beginning-of-line.

In FORTH, unadorned identifiers are interpreted in an arbitrary
manner, possibly at compile time, depending upon the class of
the identifier.  You could say that every token is a
compile time call.

In Smalltalk, C, FORTRAN, etc., I guess the usual interpretation
is as the address of something in memory, or as the value
of a variable, depending on context.  These languages
aren't so interesting to compare this way as are languages,
such as Logo and FORTH, that have fewer contexts with different
rules of interpretation.

How does your personal Ideal Programming Language (even if you
don't know anything else about it) interpret unadorned identifiers?

barmar@mit-eddie.UUCP (Barry Margolin) (09/11/84)

In article <78@rlgvax.UUCP> jack@rlgvax.UUCP (Jack Waugh) writes:
>If I
>remember correctly, Lisp treats one as a self-quoting constant.
>Lisp example:
>	(foo bar (bletch))
>In each example, the interpretation is to call bletch, then call
>foo with "bar" as its first argument, and the value returned from
>bletch is its second.

You remember incorrectly.  In Lisp, symbols are generally variables
whose values are referenced.  Special forms or macros can be used to
prevent variable evaluation, as in (setq foo bar), in which foo is
quoted, but bar is evaluated.  To get what you thought the above form
produced you would have to say (foo 'bar (bletch)), which is shorthand
for (foo (quote bar) (bletch)).  Note that in Lisp your question is not
so simple; the semantics of a form are dependent upon the context.
-- 
    Barry Margolin
    ARPA: barmar@MIT-Multics
    UUCP: ..!genrad!mit-eddie!barmar