0
$\begingroup$

Practical Foundation of Programming Languages by Harper distinguishes concept "symbol" and concept "symbol reference" which refers to a symbol:

Chapter 31 Symbols

In this chapter, we consider two constructs for computing with symbols.

The first is a means of declaring new symbols for use within a specified scope. The expression new a∼ρ in e introduces a “new” symbol a with associated type ρ for use within e. The declared symbol a is “new” in the sense that it is bound by the declaration within e and so may be renamed at will to ensure that it differs from any finite set of active symbols. Whereas the statics determines the scope of a declared symbol, its range of significance, or extent, is determined by the dynamics. There are two different dynamic interpretations of symbols, the scoped and the free (short for scope-free) dynamics. The scoped dynamics limits the extent of the symbol to its scope; the lifetime of the symbol is restricted to the evaluation of its scope. Alternatively, under the free dynamics the extent of a symbol exceeds its scope, extending to the entire computation of which it is a part. We may say that in the free dynamics a symbol “escapes its scope,” but it is more accurate to say that its scope widens to encompass the rest of the computation.

The second construct associated with symbols is the concept of a symbol reference, an expression whose purpose is to refer to a particular symbol. Symbol references are values of a type ρ sym and are written ’a for some symbol a with associated type ρ. The elimination form for the type ρ sym is a conditional branch that determines whether a symbol reference refers to a statically specified symbol. The statics of the elimination form ensures that, in the positive case, the type associated to the referenced symbol is manifested, whereas in the negative case, no type information can be gleaned from the test.

I would like to understand the two concepts "symbol" and "symbol reference" in some specific languages. For example, in Scheme,

syntax: (quote obj)
syntax: 'obj
returns: obj

does 'obj return obj?

when obj is a variable, which of obj and 'obj in Scheme is a symbol as defined in Harper's book, and which is a symbol reference as defined in Harper's book? That is:

  • Does obj in Scheme mean a symbol or a symbol reference as defined in Harper's book?
  • Does 'obj in Scheme mean a symbol or a symbol reference as defined in Harper's book? (Does notation 'obj mean the same in Scheme and in Harper's book?)

Thanks.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.