[Seaside] Accessing configuration values from the configuration

Julian Fitzell julian at beta4.com
Sat Jul 23 01:40:03 CEST 2005

William E Harford wrote:
> I crap I have been outed! You say the above like there is something
> wrong with C :-)
> I am new to Smalltalk. My backgound has mostly been in C,PHP,Perl,Java,
> and other {}(); languages. I have never particularly cared for the OOP
> implementations in most languages. I started development of my own
> prototype based OOP language and created a functioning runtime but I
> lost interest after discovering that smalltalk is %90 ideal. 
> So please forgive me if I go to a lot of effort in my code that is
> incredibly simple to do in the "Smalltalk way". It's just the way I am
> accustomed to doing it. :-)

That's ok... I remember doing similar myself once.  Welcome!  Be careful 
though... you can't ever go back.

In general, the tip off was your allocation of an array in advance and 
then putting stuff in by index.  We don't really do that in Smalltalk 
because we just use dynamically sized collections.

   coll _ OrderedCollection new.
   coll add: 'foo'.
   10 timesRepeat: [coll add: 'bar'].
   coll addAll: #(foo bar baz).
   ^ coll

you can even do away with the temp local altogether like so:

   ^ OrderedCollection streamContents:
       [:stream |
       stream nextPut: 'foo'.
       10 timesRepeat: [stream nextPut: 'bar'].
       stream nextPutAll: #(foo bar baz)]

Have fun,


   Julian Fitzell  --  Beta4 Productions
julian at beta4.com  --  http://www.beta4.com
Seaside: http://seaside.st/

More information about the Seaside mailing list