[squeak-dev] String >> #numArgs

Eliot Miranda eliot.miranda at gmail.com
Sun Dec 15 21:59:37 UTC 2019


Hi Christoph,

On Sun, Dec 15, 2019 at 3:14 AM Thiede, Christoph <
Christoph.Thiede at student.hpi.uni-potsdam.de> wrote:

> Hi all!
>
>
> Consider the following:
>
>
> foo := [:a :b | a raisedTo: b].
> bar := #raisedTo:.
>
> foo value: 2 value: 3. "5"
> bar value: 2 value: 3. "5"
>
> foo numArgs. "2"
> bar numArgs. "1"
>
> How can I overcome this inconsistency?
>

By defining a new selector, e.g. evaluableNumArgs which either adds 1 to a
Selector's numArgs (I think the right thing), or subtracts one from a
block's numArgs (nooooooo).  However, it would be wise to keep this as your
private extension and not commit it to trunk as per the objections that
Tobias and Tim have raised.

In situations where a symbol acts as "evaluable", quaking like a block, it
> is confusing to get these different results
>
> Does there already exist a unified protocol? Or am I doing something wrong
> in general when I need this?
>

Can you give some examples of where you find you are needing to do this?


> Best,
>
> Christoph
>
>

-- 
_,,,^..^,,,_
best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20191215/b0e21175/attachment.html>


More information about the Squeak-dev mailing list