[self-interest] value, value:, etc in defaultBehavior
David Ungar
ungar at me.com
Thu Dec 22 17:21:31 UTC 2011
Think varargs: value: x = (value) allows blocks and others to ignore arguments they don't care about.
Take care,
-- David (tapped out on my iPhone; blame it for any typoze;-)
On Dec 22, 2011, at 9:10 AM, Thorsten Dittmar <thormar at me.com> wrote:
> Hello David,
>
>
> for the object 17 and the method value it makes sense, but the object 17 and the method value: x it doesn't make so much sense. I always get a little bit nervous, when an object can response to a meaningless message. In our case it will answer again 17 because value: x is implemented as "self value". It would prefer to get an error, because it is much more difficult to find an error in a system that "works".
>
> anyhow, I got your intention and that was what I was asking for. Thx for answering
>
> best regards
>
> thorsten
>
>
> On Dec 22, 2011, at 5:43 PM, David Ungar wrote:
>
>>
>>
>> What is the value of 17? Or of 'foo' ? We thought it made sense that the value of 17 is 17.
>> That way you can write: max: x = ( > x ifTrue: self IfFalse: x )
>> without square brackets. The value method gets inlined out, anyway.
>> After all, 17 knows it's not a block.
>>
>> - David (from iPad, typos likely)
>>
>> On Dec 22, 2011, at 8:12 AM, Thorsten Dittmar <thormar at me.com> wrote:
>>
>>>
>>> Hello folks,
>>>
>>> I was always wondering why value and value with parameters was implemented in defaultBehavior and not in the trait block. Of course, that can make some stuff easier, but it looks a little bit like a dirty hack. Would be nice, if somebody can tell me a little bit the background of this implementation.
>>>
>>> thx
>>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.selflanguage.org/pipermail/self-interest/attachments/20111222/a6a19118/attachment.html>
More information about the Self-interest
mailing list