[comp.lang.smalltalk] ST V/286 a few questions...

MUHRTH@DB0TUI11.BITNET (Thomas Muhr) (11/15/89)

ST V/286 proves to be an 'adequate' (both from a system engineering and
a psychological standpoint) tool - but nontheless there are always some
problems where we need 'a little help from a friend':
1. Having modified DAGPane for use in our project, there is the problem
  that after invoking and then closing it from a previously opened application
  the latter won't do all the updates in it's various listpanes etc. no more.
  Something in the open-method of DAGPane disables these processes. What
  could the reason be ( a hard question without the sources - I believe)
  But maybe someone else has already stumbled over this problem.

2. ST is not always as robust as sometimes claimed: After trying to remove
   a DeletedClass in an ApplicationBrowser the system crashed with the
   (DOS ?) message: Exception 0D: General protection fault
                    Error code selector: 0000
   What happened?
3. Before reinventing the wheel and hoping that somebody gives his code
   for 'reusing' I would like to ask for:
   - an extension of TextEditor which handles word wrap inside the current
     window size.
   - an utility for better management of classes/methods (some findClasses meth
     od ?)
   - a method to get temporarily rid of ALL instances of TextPane to intro-
     duce new instance variables, better: a method to introduce instance
     variables without having to delete the whole database.

4.  Will there be a ST V/286 version in the near future which supports vir-
    tual memory after exhausting available RAM ?

5.  How can I give different colors to different subPanes?
6. Well, I will stop here for now.......
Thank you very much in advance  -

Thomas
-------
Thomas Muhr, Technical University of Berlin, BITNET: muhrth@db0tui11
   Project ATLAS - Computer Based Tools for Qualitative Research
         "Computers, like every technology, are a vehicle
   for the transformation of tradition." (WINOGRAD/FLORES)

mitsu@well.UUCP (Mitsuharu Hadeishi) (11/19/89)

To add an instance variable to a class with a lot of distributed
members, I've thought of doing this: create a duplicate of the class
with dummy instance variables that takes an instance of the
class you're modifying and copies all the instance variables
(using the primitive methods in class Object).  The do an
OriginalClass allInstances and iterate through the collection,
and for each one do "object become: (DummyClass new: object)".
Then add the instance variable to your original class, which now
no longer has any instances.  Finally, reverse the process.

I've never tried it, and it looks risky, but somehow I think it will
work, provided you don't try to use the class while you're modifying
it.  If you need to use the class, all you need to do is actually
duplicate the class (instead of just making a dummy class), i.e.,
file it out, edit the filed out class to change the name to whatever
(OriginalClassDup), then file *that* class in.  Then add the class
method to dup the class, and go through the above procedure.

Would this work?  It's seems like it should, but who knows.

cooper@netcom.UUCP (Ken Cooper) (11/21/89)

In article <14621@well.UUCP> mitsu@well.UUCP (Mitsuharu Hadeishi) writes:
>
>
>To add an instance variable to a class with a lot of distributed
>members, I've thought of doing this:

>	[ details of copying instances deleted ]

Although this approach seems reasonable, I'm pretty sure the method you've
described won't work.  The barrier that immediately stands out to me is
the use of "self become:".  Try, using Smalltalk V/286, to get an
integer to become anything other than itself.  Considering how many
instance variables there are in the system's classes, this might cause a
minor problem. 
 
Further, and perhaps more importantly, you're assuming a magical mapping
of instance variables with self become.  You'd have to depend on the order
of their declaration, which I'd feel a bit queasy about.

We've been working on a disk storage scheme for objects that deals a bit
with this issue of juggling object's instances variables, and one thing
we've learned: try not to assume too much about Digitalk's internals
(especially *across* platforms).

Ken Cooper

=============================================================================
Ken Cooper                                         USENET: cooper@netcom.uucp
Acumen Software                                Compu$erve: 71571,407
=============================================================================

chouc@mist.cs.orst.edu (Chou Chung-Di) (11/25/89)

 
 
I think I could provide some help on the third item in the third question:
"How do you introduce new instance variables to the existing class?".  I have 
applied this method in many situations, and it appeared to work well for my 
programs.
 
To incrementally add new instance variables to a class with existing instance 
variables, you should go to the class definition area (the bottom text pane of 
the ClassHierarchyBrowser, but actually you could do this in any textpane, 
this is just for the convenience of changing things faster).  For example, it 
may look like:
 
        Object subclass: #MyObjectClass
           instanceVariableNames:
              'variable1 variable2'
           classVariableNames: ''
           poolDictionaries: ''
 
Suppose you want to add a new instance variable called 'variable3' to 
MyObjectClass (or a bunch of them, maybe).  You should try to edit the text so 
it looks like the following (it is simply a Smalltalk expression):
 
        MyObjectClass instVarNames: 'variable1 variable2 variable3'.
 
and evaluate the expression with "do it".  After that, you have already 
changed the data structure of the class MyObjectClass, what you need to do 
then is to recompile all the methods that are already installed in your class.  
To do this, evaluate the following expression with do it: 
 
        MyObjectClass compileAll.
 
Then you should be able to initialze the new instance variable variable3 and 
use it accordingly.  All of these methods reside in the class Behavior in 
Smalltalk/V 286.  MetaClass might also have some interesting methods which you 
might want to take a look at.
 
Remember, the new instance variable no longer applies to the previous 
(possibly) opened window applications.  So as one possible reason to your 
first question (panes do not get updated), I like to ask you to check the 
possibility that you reuse the original applications (windows) after you made 
the changes.  I had similar symptoms when I was developing some of my programs 
before, and it was worse because even I only specified ONE "changed" method in 
the invoking method, the dependent panes updated twice!  So far I did not have 
time to look at the problem.  As one other diagnosis to your first question, 
it might be the effect of global variables floating around in your image, 
sometimes you need to re-initialize them.  This is just my guess because I 
cna't infer much information from your description.
 
One last comment to the adding new instance variable - I think it would be a 
good practice to do this using inheritance - i.e., to create your own class 
and do these management.  This is to save yourself from getting confused about 
what methods are really written by you - as you will be filing out the classes 
to disk in the future.
 
Regarding the Exception error code on question two, I notice that Digitalk had 
many versions (to my knowledge, at least two) of the v.exe file.  As I can 
recall, some of them have serious bugs.  As you could imagine, they generate 
fatal errors (and if you did not save your work frequent enough, you would be 
in BIG BIG trouble).  So check your date on the file v.exe.  It should be 
dated like september 88 (Sorry, I don't have the disk with me, so I can only 
guess).  As far as I know, this error is generated by the 386 protected mode 
exceptions, but how it got there is unknown to me!
 
-----------------------------------------------------------------------------
Disclaimer: Make backup before you try my ideas.
 
Chung-Di (Tony) Chou
Department of Industrial and Manufacturing Engineering
Oregon State University
Corvallis, OR 97331
USA