Perl-Apollo / Corinna

Corinna - Bring Modern OO to the Core of Perl
Artistic License 2.0
157 stars 19 forks source link

please determine whether inclusion in core should also include usefulness with the debugger #30

Closed wchristian closed 2 years ago

wchristian commented 3 years ago

Right now the debugger library in core provides the x facility to dump objects, which appears to also be used programmatically by third parties in order to provide runtime object inspection while debugging in more advanced UIs than the bare command line.

Right now for most standard objects the output looks like this:

  DB<1> x $x
0  Point=HASH(0x800420ab8)
   'x' => 5
   'y' => 10
  DB<2>

With Object::Pad as the prototype, things look like this:

  DB<1> x $x
0  Point=ARRAY(0x800822168)
   0  5
   1  10
  DB<2>

The second option "works" for an object as simple as this, but is hopefully obviously useless for anything of substance.

Any object dump facility might be helpful, but if decided to be the way, should be integrated in the perl core debugger library's x if this OO is to be part of the core, and it is decided this "feature" should remain usable.

If not, it should be documented clearly that the feature is broken for this type of object, and workarounds explained.

haarg commented 3 years ago

Both Data::Dumper and the debugger will definitely need to handle the objects in some way that is useful for debugging.

HaraldJoerg commented 2 years ago

As for workarounds with Object::Pad: I'm using Object::Pad too much to live without debugger support, so I've hacked the Perl debugger by using O::P's meta protocol: https://gist.github.com/HaraldJoerg/1108155847ab48a1c115a8054e878d5a Changing data with the debugger, however, is a different piece of cake and not (yet) implemented. The Perl debugger offers no command to change data: it is done by entering valid Perl statements. However, there are no valid Perl statements to change slot data which don't have a :writer - unless one is on a breakpoint within the object's class.

Ovid commented 2 years ago

This is important, but closing it in favor of https://github.com/Ovid/Cor/issues/32 as that ticket is a superset of this one.