Skip to content

Should the default dhall command emit the type to stderr? #539

Closed
@Gabriella439

Description

@Gabriella439

One issue that I've begun to run into recently is the fact that the default dhall command (i.e. no subcommand) reserves stderr for printing the inferred type of the expression. This prevents the executable from emitting useful information to stderr for successful runs.

For example, the next release of the standard will say:

An implementation SHOULD warn the user if the interpreter is unable to cache the expression due to the environment variables being unset or the filesystem paths not being readable or writeable.

The natural place to put that warning would be stderr but that would cause issues for people expecting stderr to contain the type.

Similarly, at some point we might want to provide download progress indicators for remote imports and the natural place for that would also be stderr.

Currently, users can use the dhall type subcommand to programmatically retrieve the inferred type of an expression, so there is less of a need to include the inferred type in the default command's output.

So I'm going to propose a few solutions to this problem so that we can include useful diagnostic information in stderr:

  • Omit the inferred type from stderr entirely for the default command (i.e. reserve stderr exclusively for debug output and reserve dhall type as the exclusive way to infer the type)
  • Keep the inferred type, but comment out other debug output sent to stderr so that one can still capture stderr as a valid Dhall type
  • Keep the inferred type, but don't guarantee that stderr still reflects a valid type if there is debug output

My inclination is for the second option (comment out debug output), but I'm open to other ideas

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions