Dylan Design Notes

#17: Define Like Bind	(Addition)

Version 1, March 1993
Copyright (c) 1993-1994, Apple Computer

This design note unifies the behavior of bind and define.  It  
extends  define to support declaring the types of  module variables 
and defining multiple module variables from multiple values.

-------------------------------------------------------------------

Replace the definition of define on page 31 of the Dylan manual with 
the following:

define {variable  | (variable type)}+ [#rest rest-variable ] init
	[Macro]
define creates module variables in the current module for each 
variable  and for rest-variable.  The values returned by init provide 
the initial values for these variables.

If there are more variables than there are values returned by init , 
the remaining variables are initialized to #f.  If there are more 
values returned than there are variables, the excess  values are 
placed in a sequence which is used as the initial value for rest-
variable; if there is no rest-variable, these excess values are 
discarded.  If there is a rest-variable but there is are no excess 
values, rest-variable is initialized to an empty sequence.

Each type is any expression that evaluates to a valid Dylan type.  
The types  are evaluated before the init, in the same environment as 
init. The order of evaluation of the types is not specified.  Each 
type specifies the type of the corresponding variable.  A variable 
can only contain instances of the type.  Attempts to initialize or 
assign the variable to a value which is not an instance of the 
corresponding type will result in a type-error being signaled.

The variable and rest-variable arguments must be symbols, and are not 
evaluated.

See also define-class, define-generic-function, and define-method.

[The examples on page 32 of the Dylan Manual will also need to be 
replaced.]


