[Pharo-project] [OffTopoc] Symbol understands value: nice hehehehehhe
Mariano Martinez Peck
marianopeck at gmail.com
Sat Oct 30 16:14:54 EDT 2010
On Sat, Oct 30, 2010 at 5:10 PM, Andres Valloud <
avalloud at smalltalk.comcastbiz.net> wrote:
> Keep in mind that finding senders will be more difficult, and that you may
> or may not find the code you're looking for later if it is "non-standard"
> (e.g.: with the rewrite tool, you will have to search potentially many times
> to find all occurrences of a certain piece of code). Finally, with some
> constructs, using a symbol as a valuable may not always work as expected
> (e.g.: 1 to: 10 do: #squared).
> IMO, it looks cool, but in the long run it's more of a maintenance problem.
100% agree. It was just funny for me, how could I do that, just implementing
Synbol >> value:
Just something curious and funny. Not to really use it.
> On 10/30/10 13:01 , Mariano Martinez Peck wrote:
>> Hi. Today I was giving a lesson and I was trying something something
>> like this:
>> ByteString allInstances select: [ :aString | aString size > 1000 ]
>> But sometimes, we want (not in this example) delegate the behavior to
>> the object, for example:
>> ByteString allInstances select: [ :aString | aString isTooBig ]
>> And then....I (actually, a classmate told me) realised that Symbol
>> understands value: too. So I can do this:
>> ByteString allInstances select: #isTooBig
>> and it also works :)
>> Interesting, isn't it ?
>> ps: if everybody already know this, please forgive my completly ignorance
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Pharo-dev