Red Array of Death fixed, onward to exposing Types!
After discussion in the meeting last week, I will be pumping the brakes on my mini-gallery effort. Making local variables more visible to the users is problem that needs solving, but the mini-gallery seems to add more confusion than it takes away.
Last week, when I implemented automatic type detection for new arrays, it broke everything and I was left with what I will call a Red Array of Death. Items in Looking Glass turn red when there's something wrong with them, like a reference to null. I got to the bottom of this, and it turned out to be the isValid() method on array instances. This method would go through the array and check that all the variables in the array were assignable from the array's type. Since I am making my own custom type, this was broken. I solved this by creating a new class for my custom Array Type and putting the logic for checking if a type is compatible with it in there. This new class also allowed me to clean up some of the logic I had put in wherever it could fit.
This new class solved a number of other problems I was having, including one where putting a Biped and a Flyer in the same array would force the array to be interpretted as a JavaType rather than a NamedUserType and thus have no access to user defined methods.
My next target is to figure out what to do about types. Currently, when you create an array, you have to select a type, and when you pick one, it restricts what you can put in the array. What I have been doing is setting this type to SThing so I can put whatever I want in the array, and then letting my automatic type detection sort out what base type should be used.
My initial thought was to just get rid of this type selection and have it always default to SThing. However, when you're selecting objects for your array, you probably want some inkling as to what methods are available to your array variable. The most straightforward way to do this is to say something like: These members can do anything a Biped can do, plus this set of special user fuctions they all share. If that's the case, there still is going to be some notion of types, so getting rid of type selection all together is not the move.
I made some sketches earlier about how it might look to add elements to an existing foreach loop array:
I like the idea of putting the methods available in that dialog. There is room for it, and it would make you think about what methods are available as your adding new members. It may be enough to have an area that says "Built-In Methods: <Biped>" and then "User Methods:" with a list of user methods.