I've been saving up a list of general Squeak questions, and when adding one today, I decided to ask them all at once:
- What's the easiest way of moving a method from one protocol to another, or a class from one category to another? For the former, I've been cutting-pasting code, but I can't figure out how to do the latter.
- I have some ordered collections that contain BlockContexts (e.g., the backup jobs list in PWS). When I inspect the collection, I just see "Undefined DoIt". If I inspect deeper, I can get to the bytecodes, but that's just a bit too far for me. Is there anyway to see what the original BlockContext looked like?
- I'm confused about ChangeSets vs. Projects vs. Change files. Ted K. recently suggested that I look at the Change Sorter, which is a majorly cool gadget. But I suddenly discovered that, in my 1.23 image, I had the new things from 1.21 and 1.22 in different change sets. But I had no projects with those names, and I thought that ChangeSets and Projects were related. And then I started wondering how these all resided in the same Changes file -- they must, mustn't they? Is there a paper or something that explains all of this?
- What is the maximum size of a DoIt? I exceeded it today. I was adding students to our PWS-based turnin/grading browser, three lines per student and 120 students. When I tried to select and execute the whole block of code, I got an error about "classEncoding not understood" which I didn't understand. I then tried executing the code in three chunks -- and that worked fine. I think I blew up some limit. Where is that limit? Is it something I can change?
Thanks! Mark
-------------------------- Mark Guzdial : Georgia Tech : College of Computing : Atlanta, GA 30332-0280 (404) 894-5618 : Fax (404) 894-0673 : guzdial@cc.gatech.edu http://www.cc.gatech.edu/gvu/people/Faculty/Mark.Guzdial.html
At 1:26 PM -0500 1/21/98, Mark Guzdial wrote:
I've been saving up a list of general Squeak questions, and when adding one today, I decided to ask them all at once:
- What's the easiest way of moving a method from one protocol to another,
or a class from one category to another? For the former, I've been cutting-pasting code, but I can't figure out how to do the latter.
The easiest way (I think) to move methods from protocal to protocal is the "reorganize" menu command associated with the protocal list in the browsers. Just copy and paste the method names into the desired protocal array.
From the class #Magnitude
('comparing' < <= = > >= between:and: hash hashMappedBy:) ('testing' max: min: min:max:)
To move hash from comparing to testing, accept
('comparing' < <= = > >= between:and: hashMappedBy:) ('testing' max: min: min:max: hash)
As for changing the category of a class, all you need to do is edit the definition. For example, to move (for no good reason) the class #magnitude from the category "Numeric-Magnitudes" to "Numeric-Numbers" select the class (or the class list menu item 'definition'):
Object subclass: #Magnitude instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Numeric-Magnitudes'
Then edit the category and accept the change:
Object subclass: #Magnitude instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Numeric-Numbers'
It's just like adding a variable!
Cheers, Bijan Parsia
(Mark, I'm ccing a copy to you since my posts to the list don't seem to be showing up. If you get two copies could you let me know?)
On Wed, 21 Jan 1998, Mark Guzdial wrote:
- What's the easiest way of moving a method from one protocol to another,
or a class from one category to another? For the former, I've been cutting-pasting code, but I can't figure out how to do the latter.
(On Windows) right-click on a category/protocol pane and choose reorganize. It will list the classes/methods in the form of: ('nameOfProtocol' method1 method2) or ('nameOfCategory' class1 class2)
Edit the list and accept.
-- Bolot
- What's the easiest way of moving a method from one protocol to another,
or a class from one category to another? For the former, I've been cutting-pasting code, but I can't figure out how to do the latter.
Moving a method: * choose "reorganize" from the category list menu, or * copy the method, change to the new category, paste and accept the method
Moving a class: * enter the new class category in the class definition and accept
- I have some ordered collections that contain BlockContexts (e.g., the
backup jobs list in PWS). When I inspect the collection, I just see "Undefined DoIt". If I inspect deeper, I can get to the bytecodes, but that's just a bit too far for me. Is there anyway to see what the original BlockContext looked like?
The BlockContexts should actually look like "[] in PWS class>>initialize" and not like "[] in FakeClassPool>>doIt" unless you've added the backup job manually. Printing these contexts nicely would probably involve modifying the Decompiler.
- I'm confused about ChangeSets vs. Projects vs. Change files. Ted K.
recently suggested that I look at the Change Sorter, which is a majorly cool gadget. But I suddenly discovered that, in my 1.23 image, I had the new things from 1.21 and 1.22 in different change sets. But I had no projects with those names, and I thought that ChangeSets and Projects were related. And then I started wondering how these all resided in the same Changes file -- they must, mustn't they? Is there a paper or something that explains all of this?
It's actually fairly simple. Each project has its associated change set, meaning if you create a new project you also create a new change set. There is always one active change set (called "Smalltalk changes") where currently made changes are being recorded. A change set records _what_ has changed (i.e. a class, a selector in a class etc.) but not _how_ it has changed. This is only contained in the changes file, meaning that if you browse for instance "recent versions" of a method the changes file is scanned backwards for those older versions starting from the current file location of this method. Note that there is a mark in the changes file where a previous version of a particular method may be in the file.
So in the end, there is one change file containing the source of the various changes, a number of change sets hanging around which record what has changed and one active change set. Entering a project will just activate the project's associated change set.
- What is the maximum size of a DoIt? I exceeded it today. I was adding
students to our PWS-based turnin/grading browser, three lines per student and 120 students. When I tried to select and execute the whole block of code, I got an error about "classEncoding not understood" which I didn't understand. I then tried executing the code in three chunks -- and that worked fine. I think I blew up some limit. Where is that limit? Is it something I can change?
I don't really think that this is a limitation unless you've exceeded one of the magical 256 element barriers (such as in inst vars, literals or temps).
Hope this helps. Andreas
- I have some ordered collections that contain BlockContexts (e.g., the
backup jobs list in PWS). When I inspect the collection, I just see "Undefined DoIt". If I inspect deeper, I can get to the bytecodes, but that's just a bit too far for me. Is there anyway to see what the original BlockContext looked like?
I once redefined BlockContext>>inspect to call up the debugger. I can't remember what method I called, but I'm sure it was "private". The two line hack gave me source for the defining method and even highlighted the text of the block. To do this job right I should have defined a variation of Debugger>>openOn: that would leave out useless panes and menus. (I can't remember how well it handled obsolete DoIts, which may be Mark's question.)
About this same time I stopped building blocks into long-lived structures. I can't say that I've ever missed them. That reminds me of another sweet little hack. Try defining value:value: for Symbol so that #> can serve as a sortBlock for SortedCollection. Then try (1 to 100) inject: 0 into: #+.
About this same time I stopped building blocks into long-lived structures. I can't say that I've ever missed them. That reminds me of another sweet little hack. Try defining value:value: for Symbol so that #> can serve as a sortBlock for SortedCollection. Then try (1 to 100) inject: 0 into: #+.
I only hope that none of my students have read this 8-\
Andreas
squeak-dev@lists.squeakfoundation.org