|
Re: how to create an object (of a selection of classes): msg#00107lang.smalltalk.squeak.beginners
On Jun 22, 2006, at 7:07 PM, Jeroen van Hilst wrote: I've tried something like: I like your approach. I think using the #() array here will give you Symbols - but you can use a literal array with curly braces - {EllipseMorph. RectangleMorph} to get the actual classes. (Note the period between the array elements.) This form of literal evaluates its expressions and uses the results to build the array. it's also useful when you want to build an array out of some variables, or have some short math or something to do. Just to mention it, you can also get to a class from a Symbol by doing something like Smalltalk at: #EllipseMorph if that's needed in your situation. I don't know if you saw, but collections also respond to #atRandom directly, so you could do {EllipseMorph. RectangleMorph} atRandom new. Hope this helps, Benjamin Schroeder
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | how to create an object (of a selection of classes), Jeroen van Hilst |
|---|---|
| Next by Date: | Re: how to create an object (of a selection of classes), Jeroen van Hilst |
| Previous by Thread: | how to create an object (of a selection of classes), Jeroen van Hilst |
| Next by Thread: | Re: how to create an object (of a selection of classes), Jeroen van Hilst |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |