Newbie question

Igor Stasenko siguctua at gmail.com
Mon Jul 23 18:36:41 UTC 2007


{ 'some text1' -> Class1. 'some text2' -> Class2. } do: [:each |
  each key -- for text
  each value  ---- for class
].

On 23/07/07, Bert Freudenberg <bert at freudenbergs.de> wrote:
>
> On Jul 23, 2007, at 19:59 , Ramon Leon wrote:
>
> >> The period is really a separator and not an operator. Since
> >> period is also used as a decimal point, one needs to watch
> >> out for gotchas like:
> >>  {1.2.3} = an array with two elements 1.2 and 3
> >>  {1 . 2 . 3} = an array with three elements 1, 2 and 3
> >>
> >> I wonder how period came to be used as a separator within
> >> braces in Smalltalk instead of comma or semicolon.
> >>
> >> Regards .. Subbu
> >
> > This isn't common to all Smalltalks, it's a Squeak idiom as far as
> > I know,
> > though others may have some form of literal array as well.  It also
> > makes
> > perfect sense to use a period, since the period is "the" statement
> > seperator
> > for expressions in Smalltalk.
>
> Right - just like a block it evaluates all statements in turn,
> separated by periods. But whereas a block returns the result of the
> last statement, the brace construct collects all results and returns
> them as an array.
>
> Now, at one point the compiler even supported this:
>
>         {a. b} := {1. 2}
>
> which I found cool but was considered evil, even by those who
> tolerate the braces ...
>
> - Bert -
>
>
>
>


-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list