Skip to content

Limit nothing interpolation error to AbstractCmd subtypes #30008

Closed
@omus

Description

@omus

The introduction of disallowing print/string with nothing (#27829) has introduced some headaches. From a recent #gripes session:

Mike Innes [2018-11-07 07:50]

julia> xs = [1, 2, 3]

julia> xs[nothing]
ERROR: ArgumentError: `nothing` should not be printed; use `show`, `repr`, or custom output > instead.

Simon Danisch [08:32]
I'm getting so sick of nothing should not be printed errors 😄 The worst is, they usually happen in the display stack, which has the bad habbit of removing stack traces

Eric Davies [10:43]
It feels like an evil wizard is like "haha! you've fallen into my 'printing nothing' trap!"
And it causes so many special cases to be written in Base and in user code, all because special > casing Cmd interpolation was too hard to do in the very short period of time before release.

Stefan Karpinski [10:46]
I think it would be fine to limit the nothing error to splicing nothing into command objects

Stefan Karpinski [10:46]
if someone wants to make a PR for that

Metadata

Metadata

Assignees

No one assigned

    Labels

    display and printingAesthetics and correctness of printed representations of objects.error handlingHandling of exceptions by Julia or the user

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions