Skip to content

Revert #8395 "Treat empty pipelines as pass-through" - #9472

Merged
sophiajt merged 1 commit into
mainfrom
revert-8395-forgiving_strict_iter
Jun 20, 2023
Merged

sophiajt merged 1 commit into
mainfrom
revert-8395-forgiving_strict_iter

Conversation

@sholderbach

Copy link
Copy Markdown
Member

In my view we should revert #8395 for now

Potentially inconsistent application of semantic change

#8395 (1d5e7b4) was loosening the type coercion rules significantly, to let missing data / void returns that were either expressed by PipelineData::Empty or the Value::nothing be accept by specifically those commands/operations that made use of PipelineData::into_iter_strict(). This could apply the new rules inconsistently.

Turning explicit failures into silent continuations

Furthermore the effect of this breaking change to the missing data semantics could make previous errors into silent failures.
This could either just reduce the effectiveness of teaching error messages in interactive use:

Contrived example before

> cd . | where blah
Error: nu::shell::only_supports_this_input_type

  × Input type not supported.
   ╭─[entry #13:1:1]
 1 │ cd . | where blah
   ·        ──┬──┬
   ·          │  ╰── input type: null
   ·          ╰── only list, binary, raw data or range input data is supported
   ╰────

...after, with #8395

> cd . | where blah
╭────────────╮
│ empty list │
╰────────────╯

In rare cases people could already try to rely on catching an error of a downstream command to actually deal with the missing data, so it would be a breaking change for their existing code.

Problem with PipelineData::into_iter_strict()

Maybe this makes _strict a bit of a misnomer for this particular iterator construction.
Further we did not actively test the PipelineData::empty branch before
grafik

Parsimonious solution exists

For the motivating issue #8393 there already exists a fix that makes ls more consistent with the type system by returning an empty Value::List #8439

@amtoine amtoine left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is very sensible to me 👍

@sophiajt
sophiajt merged commit 1be4eae into main Jun 20, 2023
@sophiajt
sophiajt deleted the revert-8395-forgiving_strict_iter branch June 20, 2023 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants