[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [patch #6071] Resing/Deleting/Inserting variables in GUI

From: Ben Pfaff
Subject: Re: [patch #6071] Resing/Deleting/Inserting variables in GUI
Date: Tue, 17 Jul 2007 08:47:44 -0700
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.99 (gnu/linux)

John Darrington <address@hidden> writes:

> Consider this example:
> 1. A GUI user loads a system file with the following variables:
> name type        dict_idx  case_idx
> ---- ----        --------  --------
> v1   string (8)  0         0
> v2   string (8)  1         1
> v3   numeric     2         2
> v4   numeric     3         3
> 2. He decides to insert a new variable (vNew) before v2.  The
>    situation becomes:
> v1   string (8)  0         0
> vNew numeric     1         4
> v2   string (8)  2         1
> v3   numeric     3         2
> v4   numeric     4         3

This is where I think we part ways.  I was contending that we
should keep the dictionary and the datasheet in the same order:
that is, insert vNew with case_idx 1 and push v2...v4 one
position to the right.

Now, what I hadn't thought about is that in fact data for
arbitrary dictionaries gets stuck into datasheets, not just data
for nicely ordered dictionaries like this.  Given that, the
problem is more complicated.  We'd need to rearrange the columns
in the datasheet to match the order of the dictionary variables.

> If we can devise an implementation of dict_compact_values that
> compacts/pads without re-ordering, then this would be one solution.  I
> don't know if such an implementation can work in linear time. 

The example clarifies things for me.  Let's just go with your
patch for now.  As long as you're willing to make dict_pad_values
static and fix that assertion, I'm happy with it now.

I am starting to think that perhaps the assignment of
"case_index"es should be handled by a separate object.  But I
don't know whether it's worth it.  Maybe it can be a cleanup
later, if it helps.  Let's just use your code for now.
Ben Pfaff

reply via email to

[Prev in Thread] Current Thread [Next in Thread]