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: Jose E. Marchesi
Subject: Re: [PATCH] cmd: set: Introduce tree-print set sub-command
Date: Wed, 12 Feb 2020 16:18:15 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

    
    > 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.
    
Oh I see.  Yes I agree with you, what you implemented is more clear :)




reply via email to

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