Skip to content

Separate "repr" and "display" string representations #20

Description

@p7g

Right now, printing an array is a "repr" type of display (not sure if there is any other alternative), but printing a string or char does not escape any characters, nor does it wrap the value in quotes. This can be annoying when printing an array of strings or characters.

Inspired by Python, it could be something like this:

  1. If a value supports a "to string" operation, use that (this would be the "display" representation)
  2. Otherwise, get the "repr" string for the value. This would look similar to a literal for the value in most cases.
  3. If a value contains other values, the repr for the outermost value should use the repr for inner values.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions