On Friday, 8 April 2016, Valentin Ryckewaert <valentin.ryckewaert@gmail.com> wrote:
Hello everyone,

i'm learning Pharo and i'm having difficulties to understand the symbols, what are they? How are they different of the ByteString ? Why are they usefull ?
Why should I put #string where I can put 'string' ?
Hi,

As the others said, symbols are some kind of string that are unique in the image. I would like to talk also about a super cool feature.��

A Block can receive the message #value:. For example when you do a #do: on a collection, the block will receive multiple #value: message with the element in argument.��

[ :class | class allSubclasses] value: Object.

And the cool feature is that Symbol also have this method, so with the polymorphism you can do:

#AllSubclasses value: Object

{ Object . Morph . Integer . Float } collect: #allSubclasses

This is a pretty cool feature that I wanted to share.
��

Thanks in advance for your answer.
Valentin Ryckewaert


--
Cheers
Cyril Ferlicot