[Prev][Next][Index][Thread]

Re: Q: Symbol optional in keyword parameter definition?



Roland Paterson-Jones rolandpj@bigfoot.com on  2001-06-25 10:00 wrote:

> The BNF for dylan in "The Dylan Reference Manual", p. 426, describes a
> keyword parameter as:
> 
> keyword-parameter:
>   SYMBOL(opt) variable default(opt)
> 
> i.e. the keyword symbol is optional(?).
> 
> What does it mean when you define a method such as:
> 
> define method m( req1, req2, req3, #key key1 ) ...
> 
> where key1 is a keyword parameter with no associated keyword symbol? How can
> key1 be bound and used?

The key defaults to being the name of the variable.  You are permitted to
specify a key that is different from the variable.  Handy when the key name
is a reserved word (which would not be permitted as a variable name).



References: