<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><h3><font size="3"><span style="font-weight: normal;">Here's an additional idea - using "empty" keywords for optional method arguments (from&nbsp;<a href="http://piumarta.com/pepsi/pepsi.html">http://piumarta.com/pepsi/pepsi.html</a>):</span></font></h3><h3><span style="font-family: Times; ">3.4&nbsp;&nbsp;&nbsp;Method definitions</span></h3><span style="font-family: Times; ">Methods are just 'named blocks', tied to a particular prototype only by permitting direct access to the state within that prototype. (Therein lies yet another reason to abolish direct access to state.) This is reflected in the syntax of the top-level form for adding methods (named blocks) to a prototype:</span><blockquote style="font-family: Times; "><i>name</i>&nbsp;<i>pattern</i>&nbsp;[&nbsp;<i>statements</i>&nbsp;]</blockquote><span style="font-family: Times; ">where&nbsp;</span><i style="font-family: Times; ">name</i><span style="font-family: Times; ">&nbsp;identifies a prototype object (defined as described above),&nbsp;</span><i style="font-family: Times; ">pattern</i><span style="font-family: Times; ">&nbsp;looks (more or less) like a Smallalk-80 message pattern, and&nbsp;</span><i style="font-family: Times; ">statements</i><span style="font-family: Times; ">&nbsp;is a block (notice the brackets) providing the behaviour for the method. The&nbsp;</span><i style="font-family: Times; ">pattern</i><span style="font-family: Times; ">&nbsp;component can be a unary, binary or keyword message pattern.</span><p style="font-family: Times; ">Extensions to Smalltalk's fixed-arity messages include additional and variadic formal arguments. Additional formal arguments for unary and keyword selectors are written like block arguments and can appear before or after the initial opening bracket. For example, two additional formal arguments could be written</p><blockquote style="font-family: Times; "><i>name</i>&nbsp;<i>selector</i>&nbsp;:<i>arg1</i>&nbsp;:<i>arg2</i>&nbsp;[&nbsp;<i>statements</i>&nbsp;]<br><i>name</i>&nbsp;<i>selector</i>&nbsp;[ :<i>arg1</i>&nbsp;:<i>arg2</i>&nbsp;|&nbsp;<i>statements</i>&nbsp;]</blockquote><span style="font-family: Times; ">(where&nbsp;</span><i style="font-family: Times; ">selector</i><span style="font-family: Times; ">&nbsp;is a unary or keyword selector). Unary or keyword message sends can pass additional actual arguments by prefixing each additional argument with a colon. To ask the receiver to&nbsp;</span><tt>add</tt><span style="font-family: Times; ">&nbsp;two numbers:</span><blockquote style="font-family: Times; "><pre>Object add :x :y
[
  ^x + y
]

[
  | sum |
  sum := self add :3 :4.
]
</pre></blockquote><span style="font-family: Times; ">Variadic arguments can be attached to unary or keyword methods. This is indicated by an ellipsis in the message pattern immediately following the last named argument. The&nbsp;</span><i style="font-family: Times; ">pattern</i><span style="font-family: Times; ">&nbsp;for unary and keyword syntax therefore also includes:</span><blockquote style="font-family: Times; "><i>name</i>&nbsp;<i>unarySelector</i>&nbsp;... [&nbsp;<i>statements</i>&nbsp;]<br><i>name</i>&nbsp;<i>keywords: arguments</i>&nbsp;... [&nbsp;<i>statements</i>&nbsp;]<br></blockquote><p style="font-family: Times; ">(Simply for lack of time, there is currently no friendly syntax to recover the 'rest' arguments within the body of a message. Wizards, however, can easily recover these arguments by writing some low-level magic inside a method body.)</p><div apple-content-edited="true">- Bert -<br></div><br></body></html>