[squeak-dev] String >> #numArgs
Marcel Taeumel
marcel.taeumel at hpi.de
Mon Dec 16 08:22:42 UTC 2019
> bar := #raisedTo:.
> bar value: 2 value: 3.
Woah! This works? When and why is this useful? Does anybody recall the prime example? :-) #inject:into:?
I mean, "bar numArgs" works as expected and so does "foo numArgs". That #value:value: on Symbol is surprising for me here.
Best,
Marcel
Am 16.12.2019 04:57:56 schrieb John Pfersich via Squeak-dev <squeak-dev at lists.squeakfoundation.org>:
Besides 2 raisedTo: 3 should answer 8, not 5.
/————————————————————/
For encrypted mail use jgpfersich at protonmail.com
Get a free account at ProtonMail.com
Web: www.objectnets.net and www.objectnets.org
On Dec 15, 2019, at 03:15, 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?
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?
Best,
Christoph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20191216/24e6e5ec/attachment.html>
More information about the Squeak-dev
mailing list
|