poke-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] cmd: set: Introduce tree-print set sub-command


From: Carlo Caione
Subject: Re: [PATCH] cmd: set: Introduce tree-print set sub-command
Date: Wed, 12 Feb 2020 16:05:51 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

On 12/02/2020 15:50, Jose E. Marchesi wrote:

Hi Carlo.

Hi Jose,

I thought about a corner case: when the elements of an array span for
several lines (i.e. they are structs) I get this:

(poke) deftype Foo = struct { int i; long j; }
(poke) .set tree-print deep
(poke) Foo[3] @ 0#B
[Foo {
    i=0x464c457f,
    j=0x10102L
  },Foo {
    i=0x0,
    j=0x1003e0001L
  },Foo {
    i=0x0,
    j=0x0L
  }]

What about emitting this instead:

(poke) Foo[3] @ 0#B
[Foo {
    i=0x464c457f,
    j=0x10102L
  },
  Foo {
    i=0x0,
    j=0x1003e0001L
  },
  Foo {
    i=0x0,
    j=0x0L
  }]

I think it is slightly more readable this way.

Yeah, I tested this case and I liked the first output more because you can clearly tell (from ` },Foo { `) that the Foo struct is part of an array.

The second case can be misinterpreted as an unnamed struct:

(poke) deftype Foo = struct { int i; int j; }
(poke) deftype Bar = struct { Foo; }
(poke) .set tree-print deep
(poke) Bar @ 0#B

Bar {
   Foo {
     i=0xdf7f30d,
     j=0x1c0b1487
   }
 }

As you can see the unnamed struct matches with your second case (even though we can clearly see that it is not an array).

That said, at the end of the day it is really matter of personal taste so let me know if you still want me to change that.

Cheers!

--
Carlo Caione



reply via email to

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