Previous chapter: #22: BNF for Infix Dylan (Change)

Dylan Design Notes

Dylan Design Notes: #23: Defining Forms Make Constants (Change)

#23: Defining Forms Make Constants (Change)

Version 1, January 1994
Copyright (c) 1993-1994, Apple Computer
This design note makes define-method more consistent with define-generic-function. It also provides general declarative forms for defining constants and variables.
Rename define to define-constant.

Specify that define-generic-function, define-class, define-constant, and define-method all create read-only variables. These variables cannot be assigned new values.

In addition, specify a new defining form, define-variable, which creates variables that are not read-only. define-variable has the same syntax as define-constant. There is no return value specified for define-variable.


In the Dylan book's definition of define-method, the statement "If the module variable variable-name is not already defined, it is first defined (as with define) ..." implies that define-method does not create read-only variables, which would be inconsistent with define-generic-function. This Design Note clears up that inconsistency.

In addition, the Dylan book specifies that define-generic-function and define-class create read-only variables. However, it does not specify a declarative way to create read-only variables in the general case.

Next chapter: #24: Divide by Zero Signals Error (Clarification)