go-delve / delve

Delve is a debugger for the Go programming language.
MIT License
22.99k stars 2.14k forks source link

allow pretty printing of variables using starlark scripts #2887

Open aarzilli opened 2 years ago

aarzilli commented 2 years ago

Split from discussion in PR #2865

It could be useful to let user pretty print variables using starlark scripts. There are however some obstacles to doing this:

mark-pictor-csec commented 2 years ago

what happens to the pretty printer for time.Time, which is much easier to write in go rather than starlark

I had a thought related to this, but it's flawed. I'll throw it out there in case someone sees a workaround for the flaw...

Would it be possible to have a generic pretty printer that'd work for any type implementing fmt.Stringer, fmt.GoStringer, and/or fmt.Formatter, by invoking that interface method? Such a pretty printer could be written in go, should be straightforward, and would cover many types.

The flaw is, there's no guarantee that the method being invoked is side effect free.