|
Re: Populate a new array.: msg#00098lang.smalltalk.squeak.beginners
On Mar 15, 2007, at 10:54 , Michael van der Gulik wrote: Also, observing that "at:" is actually implemented in Object, which seems...odd! Wrong. Any Squeak object is made of zero or more instance variables ("named variables") plus zero or more numbered variables ("indexed variables"). The difference is that the number of named variables is fixed for all objects of that class, but the number of indexed variables can be specified when creating an instance using #new:, so it can differ from instance to instance. Object>>at: lets you access those indexed variables. How else would you access these? It's not often useful (and downright dangerous if you ask me) Huh? It provides the very basics of the system! If we Smalltalkers say "everything is an Object" we mean it. Literally. There is no special "array object" that is different from "regular objects". Rather, you can implement an array as an object that happens to have indexed variables: Object variableSubclass: #BertsArray instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Bert-Arrays'. (BertsArray new: 7) at: 5 put: 42 - Bert -
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Morphic event-handling confusion, Michael van der Gulik |
|---|---|
| Next by Date: | Re: Morphic event-handling confusion, Bert Freudenberg |
| Previous by Thread: | Re: Populate a new array., Michael van der Gulik |
| Next by Thread: | Re: Populate a new array., Michael van der Gulik |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |