[Seaside] A litle question about Sets

Julian Fitzell jfitzell at gmail.com
Mon Mar 1 18:40:10 UTC 2010


On Mon, Mar 1, 2010 at 3:35 PM, Michael Delache <vladmanchev at gmail.com> wrote:
> Hi all,
>
>   I defined an object called AlbumAuthor.
> In an other object, Album, I putted a instance variable called authors which
> will contain the authors of the album.
> So, I would like to know if I can define the instance as a Set but
> containing only AlbumAuthor type objects.
>
> I don't know if it's possible to do this. Someone could help with this one?

Hi Michael,

Smalltalk, being dynamically typed, almost never limits objects by
class. And Smalltalk collections are not "typed" the way C or Java
arrays are.

Of course you *could* implement your own collection class that checked
the class of the object being added and raised an error if it was not
appropriate, but this would be considered bad style by most smalltalk
programmers, I think.

(as Randal points out, generally questions about smalltalk itself
would be better posted on the Squeak beginners list or similar)

Cheers,

Julian


More information about the seaside mailing list