Open aarzilli opened 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.
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: