risor icon indicating copy to clipboard operation
risor copied to clipboard

Adjust print formatting

Open myzie opened this issue 6 months ago • 1 comments

These changes make print-formatting for Risor objects generally more usable.

The idea here is to:

  1. print primitive types exactly the same as Go would (bool, nil, int, float, byte, error, string)
  2. special case for times (Risor uses RFC3339 formatting which is my preference)
  3. otherwise use the Risor object String() or Inspect() methods to get the equivalent string to print

The print format for items in category 1 remain unchanged from previous versions of Risor.

Categories 2 and 3 are a change. In many cases the previous formats weren't terribly usable, so I think this is a change for a better and most programs are unlikely to depend on an exact print() format.

Fixes https://github.com/risor-io/risor/issues/247

myzie avatar Jul 28 '24 18:07 myzie