Hello, I am trying to read the methods of several classes. I am getting a messagenotunderstood for the following code: TempObject := #(OrderedCollection Integer). TempObject do: [ :iClass | iClass selectorsDo: [ :item | item.]]. I can run a iClass name successfully. But it doesn't seem to recognize iClass selectors. Thank You! Jonathan _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
On 03.07.2011, at 18:35, Jonathan Wright wrote:
> > Hello, > > I am trying to read the methods of several classes. I am getting a > messagenotunderstood for the following code: > > TempObject := #(OrderedCollection Integer). > TempObject do: [ :iClass | > iClass selectorsDo: [ :item | > item.]]. > > I can run a iClass name successfully. Try iClass class, that should be enlightening ;) > But it doesn't seem to recognize iClass selectors. The "name" message works on any (see Object>>name). iClass is not actually a class in your example. Hint 1: #() creates a literal array. Hint 2: Classes are not literals. Hint 3: {} creates a non-literal array. Nitpick: temps should have lowercase-names. - Bert - _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
On Sun, 3 Jul 2011 18:47:09 +0200
Bert Freudenberg <[hidden email]> wrote: > On 03.07.2011, at 18:35, Jonathan Wright wrote: > > > > > Hello, > > > > I am trying to read the methods of several classes. I am getting a > > messagenotunderstood for the following code: > > > > TempObject := #(OrderedCollection Integer). > > TempObject do: [ :iClass | > > iClass selectorsDo: [ :item | > > item.]]. > > > > I can run a iClass name successfully. > > Try iClass class, that should be enlightening ;) > > > But it doesn't seem to recognize iClass selectors. > > The "name" message works on any (see Object>>name). iClass is not > actually a class in your example. > > Hint 1: #() creates a literal array. > > Hint 2: Classes are not literals. > > Hint 3: {} creates a non-literal array. > > Nitpick: temps should have lowercase-names. > > - Bert - > > _______________________________________________ > Beginners mailing list > [hidden email] > http://lists.squeakfoundation.org/mailman/listinfo/beginners > Awesome, thanks for the hints! It works now! In finding information about non-literal arrays, it seems you put periods in between the array contents. I'm not sure I understand iClass class. It just seems to add class at the end. I suppose I would now have extra methods to work with in doing that? Regarding TempObject, yeah I've been using it as a global variable for a while now, so it should be capitalized in my case. :-) I read all about the capitalization guidelines for smalltalk and it all makes sense to me. Again, thanks for the help! Kind Regards, Jonathan _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
On 03.07.2011, at 19:48, Jonathan Wright wrote: > On Sun, 3 Jul 2011 18:47:09 +0200 > Bert Freudenberg <[hidden email]> wrote: > >> On 03.07.2011, at 18:35, Jonathan Wright wrote: >> >>> >>> Hello, >>> >>> I am trying to read the methods of several classes. I am getting a >>> messagenotunderstood for the following code: >>> >>> TempObject := #(OrderedCollection Integer). >>> TempObject do: [ :iClass | >>> iClass selectorsDo: [ :item | >>> item.]]. >>> >>> I can run a iClass name successfully. >> >> Try iClass class, that should be enlightening ;) >> >>> But it doesn't seem to recognize iClass selectors. >> >> The "name" message works on any (see Object>>name). iClass is not >> actually a class in your example. >> >> Hint 1: #() creates a literal array. >> >> Hint 2: Classes are not literals. >> >> Hint 3: {} creates a non-literal array. >> >> Nitpick: temps should have lowercase-names. >> >> - Bert - >> >> _______________________________________________ >> Beginners mailing list >> [hidden email] >> http://lists.squeakfoundation.org/mailman/listinfo/beginners >> > > Awesome, thanks for the hints! It works now! > > In finding information about non-literal arrays, it seems you put > periods in between the array contents. > > I'm not sure I understand iClass class. It just seems to add class at > the end. I suppose I would now have extra methods to work with in > doing that? No, I meant if you had tried that in your original example it would have answered "Symbol". Because that's what literal arrays store for unembellished identifiers (except for "nil", "true", and "false"). > Regarding TempObject, yeah I've been using it as a global variable for a > while now, so it should be capitalized in my case. :-) I read all > about the capitalization guidelines for smalltalk and it all makes > sense to me. In that case, it's all right. I guess the appropriate longevity of "temp" vars is in the eye of the beholder ;) - Bert - _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
Free forum by Nabble | Edit this page |