Re: Yay for me, found an interpreter bug!
On Tuesday 04 November 2003 06:52 pm, Pete wrote:
> Irv, can you explain to me the difficulties of changing (I'm guessing
> here), eg getRow() to getRow(instance), and getTable() to
> GetTable(instance)?
If I understand your idea correctly, yes.
I want to write an include which can manage, for example, three database
tables, displayed in three different list formats, with three different pop-up
menus, and edited with three different edit windows.
Using instance variables, I would need to write the include so that it would
have an array of tables {"CONTACTS","SCHEDULES","TODO"}
an array of pointers to the proper list controls (different tables need their
own lists with different list headers) an array of integers to hold the
currently-selected row of each list, an array of entry fields, so that the
contents of the correct fields would be transferred into the database at the
conclusion of an edit, an array of titles for those entry fields, so they
would appear with meaningful labels, an array of buttons and the functions
that they call, etc.
Every time I added a new table and list, I would have to expand all those
arrays. Plus, there would need to be a lot of if ... then coding to choose
the correct buttons, correct labels, correct entry fields to use, depending
upon the "instance" being called.
Then there's the problem of duplicate controls. For example, almost all
windows will have an "OK" button. But the same "OK" button can't be used
in more than one window, so I would have to declare separate "OK" buttons,
one for each instance *at the time I write the include*.
Compare the method that Aku suggested:
I can write the one include, just as if it was intended to manage only one
table and its associated controls. No array mess. Then, by including it
multiple times, I get multiple, independent instances of everything. And
those instances are accessible using standard namespacing, i.e.
contacts:list, schedule:current_selection, contacts:okbutton, etc.
> As I started with my last reply to Al, I'm not *anti* anything, just
> engaging in discussion.
>
> Do you have any thoughts on extra difficulties this might cause when
> debugging, for instance? Equally, any thoughts on "getting lost" when
> debugging because you're looking at the wrong "copy of" the
> source/variables? How would you really know?
I don't believe that would be a problem.
As I mentioned earlier, the ex.err message seems clear, it even shows the
(mulltiple) instances of the variable in question.
Irv
--
Windows 98 is *NOT* a virus - viruses are small and efficient.
|
Not Categorized, Please Help
|
|