Skip to content

Consider deleting custom show methods for types #321

@andreasnoack

Description

@andreasnoack

I.e. https://github.com/PainterQubits/Unitful.jl/blob/7fb2dfb68c63c0a77b8c859c294d8b7f03f337d6/src/display.jl#L80-L85. There are two reasons for this.

The first is that, according to the compiler team, the base methods are not supposed to be overloaded. It's not documented and not obvious but it's been assumed that show(::IO, ::Type) isn't overloaded by user code so doing that can lead to very odd issues. E.g. the definitions in this package might have caused Documenter to hang for one of my packages because Documenter prints the signature of methods with missing docs.

The second reason is that it can be super confusing when types print differently from what they really are. I've had some issues with that when using this package because I based some function signatures on how the types were printed in the REPL only to get an error because the signature didn't match.

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