www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.debugger - Visual D Debugger long array expansion indexing fix

reply Brett <Brett gmail.com> writes:
does things like [1000...2000]

but then lists the values as [0], [1], ...

Could it use the absolute values [1000], [1001], etc?

That way one doesn't have to do mental arithmetic?

Obviously not difficult but I see no reason to not do it.
Sep 17 2019
parent reply Brett <Brett gmail.com> writes:
On Tuesday, 17 September 2019 at 13:48:33 UTC, Brett wrote:
 does things like [1000...2000]

 but then lists the values as [0], [1], ...

 Could it use the absolute values [1000], [1001], etc?

 That way one doesn't have to do mental arithmetic?

 Obviously not difficult but I see no reason to not do it.
Also, can AA arrays have their keys sorted? Lexicographical should work. I see no reason not to sort them, specially when the keys are integers, helps locate values in large arrays much easier.
Sep 17 2019
parent reply Brett <Brett gmail.com> writes:
On Tuesday, 17 September 2019 at 17:19:22 UTC, Brett wrote:
 On Tuesday, 17 September 2019 at 13:48:33 UTC, Brett wrote:
 does things like [1000...2000]

 but then lists the values as [0], [1], ...

 Could it use the absolute values [1000], [1001], etc?

 That way one doesn't have to do mental arithmetic?

 Obviously not difficult but I see no reason to not do it.
Also, can AA arrays have their keys sorted? Lexicographical should work. I see no reason not to sort them, specially when the keys are integers, helps locate values in large arrays much easier.
And maybe add a linear index on AA's so it is easier to locate values(and/or show length).
Sep 17 2019
parent reply Rainer Schuetze <r.sagitario gmx.de> writes:
On 17/09/2019 22:04, Brett wrote:
 On Tuesday, 17 September 2019 at 17:19:22 UTC, Brett wrote:
 On Tuesday, 17 September 2019 at 13:48:33 UTC, Brett wrote:
 does things like [1000...2000]

 but then lists the values as [0], [1], ...

 Could it use the absolute values [1000], [1001], etc?

 That way one doesn't have to do mental arithmetic?

 Obviously not difficult but I see no reason to not do it.
The nice thing about the current implementation is that there is no extra state but the expression to be passed around by the evaluation (a[1001] == a[1000..2000][1]), but I agree that it is a bit confusing. Maybe there is some other solution...
 Also, can AA arrays have their keys sorted? Lexicographical should
 work. I see no reason not to sort them, specially when the keys are
 integers, helps locate values in large arrays much easier.
This can be a bit expensive for large arrays as all elements need to be read and cached before displaying the first. This is usually done incrementally by the debugger.
 
 And maybe add a linear index on AA's so it is easier to locate
 values(and/or show length).
 
This would be easier, but probably not so interesting if not also sorted.
Sep 20 2019
parent Brett <Brett gmail.com> writes:
On Friday, 20 September 2019 at 07:27:51 UTC, Rainer Schuetze 
wrote:
 On 17/09/2019 22:04, Brett wrote:
 On Tuesday, 17 September 2019 at 17:19:22 UTC, Brett wrote:
 On Tuesday, 17 September 2019 at 13:48:33 UTC, Brett wrote:
 does things like [1000...2000]

 but then lists the values as [0], [1], ...

 Could it use the absolute values [1000], [1001], etc?

 That way one doesn't have to do mental arithmetic?

 Obviously not difficult but I see no reason to not do it.
The nice thing about the current implementation is that there is no extra state but the expression to be passed around by the evaluation (a[1001] == a[1000..2000][1]), but I agree that it is a bit confusing. Maybe there is some other solution...
 Also, can AA arrays have their keys sorted? Lexicographical 
 should work. I see no reason not to sort them, specially when 
 the keys are integers, helps locate values in large arrays 
 much easier.
This can be a bit expensive for large arrays as all elements need to be read and cached before displaying the first. This is usually done incrementally by the debugger.
True. Could have a maximum setting, say, 1000 or 10000. Usually if the array is large one isn't going to look at it much anyways so the worst case is also the rarest.
 
 And maybe add a linear index on AA's so it is easier to locate
 values(and/or show length).
 
This would be easier, but probably not so interesting if not also sorted.
Right, but it helps with locating the index in a large array.. e.g., what is the 245th value. Well, now one has to count but if the index was next to it(or a mouse over could show it) then it would be instant. It might not help in most cases though but in my particular case it helps since keys are indexes too. It could be optional to show it and if sorting is added then it would just work hand and hand.
Sep 22 2019