Skip to content

remove the $nothing variable#10478

Merged
amtoine merged 4 commits intonushell:mainfrom
amtoine:remove-nothing-variable
Sep 26, 2023
Merged

remove the $nothing variable#10478
amtoine merged 4 commits intonushell:mainfrom
amtoine:remove-nothing-variable

Conversation

@amtoine
Copy link
Copy Markdown
Member

@amtoine amtoine commented Sep 23, 2023

related to

thanks to @jntrnr and their super useful tips on this PR, i learned about the parser + evaluation, so 🙏

Description

because we already have null as the value of the type nothing and as a followup to the two other attempts of mine, i propose to remove the redundant $nothing built-in variable 😋

this PR is the first step, deprecating $nothing.
a followup PR will remove it altogether and wait for 0.87 👍

⚙️ details: a new NOTHING_VARIABLE_ID = 3 has been added, parsing $nothing will create it, finally a Value::Nothing will be produced and a warning will be reported.

this PR already fixes the toolkit.nu module so that it does not throw a bunch of warnings each time 👌

User-Facing Changes

$nothing is now deprecated and will be removed in 0.87

> $nothing
Error:   × Deprecated variable
   ╭─[entry #1:1:1]
 1  $nothing
   · ────┬───
   ·     ╰── `$nothing` is deprecated and will be removed in 0.87.
   ╰────
  help: Use `null` instead

Tests + Formatting

tests have been updated, especially

  • nothing_fails_string
  • nothing_fails_int
    which use a variable called nil now to make sure nothing does not support cell paths 👍

After Submitting

classic deprecation mention 👍

`NOTHING_VARIABLE_ID` is now 3.
this changes the tests and the toolkit, i.e. all mentions to `$nothing`
except for those of the deprecation itself.
@amtoine amtoine added notes:mention Include the release notes summary in the "Hall of Fame" section category:deprecation Related to the deprecation of commands/features/options labels Sep 23, 2023
Copy link
Copy Markdown
Member

@sholderbach sholderbach left a comment

Choose a reason for hiding this comment

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

Thanks so much for tackling this with deprecation.

I would say let's mark this as draft until we have made sure the important integrations are up to date as we can update them already to null

@sholderbach
Copy link
Copy Markdown
Member

Went through the list of integrations that advertise in https://github.com/nushell/nushell#officially-supported-by with the admittedly imperfect github search.

Only found https://github.com/atuinsh/atuin/blob/fbed2862fda127b747718e4ae6f5f36a56f29a51/atuin/src/shell/atuin.nu to use... null. So I think we should be good, if we have nu_scripts updated.

Copy link
Copy Markdown
Member

@sholderbach sholderbach left a comment

Choose a reason for hiding this comment

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

The $nothing deprecation looks good to me.

We could make the changing of the "magic" variable IDs a bit more robust in the future by either doing everything with an enum (a bit more hassle) or having a LAST_MAGIC_VARIABLE_ID const that is used for those checks. But not a blocker for this PR.

sholderbach added a commit to sholderbach/nu_scripts that referenced this pull request Sep 26, 2023
@amtoine
Copy link
Copy Markdown
Member Author

amtoine commented Sep 26, 2023

let's go with this, bye $nothing, enjoy your last release 😏

@amtoine amtoine merged commit 6c02624 into nushell:main Sep 26, 2023
@amtoine amtoine deleted the remove-nothing-variable branch September 26, 2023 16:49
sholderbach added a commit to nushell/nu_scripts that referenced this pull request Sep 26, 2023
`$nothing` will be deprecated in nu 0.86

This accompanies
- nushell/nushell#10478
amtoine added a commit that referenced this pull request Oct 19, 2023
related to 
- #10478

# Description
this PR is the followup removal to
#10478.

# User-Facing Changes
`$nothing` is now an undefined variable, unless define by the user.
```nushell
> $nothing
Error: nu::parser::variable_not_found

  × Variable not found.
   ╭─[entry #1:1:1]
 1 │ $nothing
   · ────┬───
   ·     ╰── variable not found.
   ╰────
```

# Tests + Formatting

# After Submitting
mention that in release notes
gaetschwartz pushed a commit to gaetschwartz/nushell that referenced this pull request Oct 20, 2023
related to 
- nushell#10478

# Description
this PR is the followup removal to
nushell#10478.

# User-Facing Changes
`$nothing` is now an undefined variable, unless define by the user.
```nushell
> $nothing
Error: nu::parser::variable_not_found

  × Variable not found.
   ╭─[entry nushell#1:1:1]
 1 │ $nothing
   · ────┬───
   ·     ╰── variable not found.
   ╰────
```

# Tests + Formatting

# After Submitting
mention that in release notes
hardfau1t pushed a commit to hardfau1t/nushell that referenced this pull request Dec 14, 2023
related to 
- nushell#9973
- nushell#9918

thanks to @jntrnr and their super useful tips on this PR, i learned
about the parser + evaluation, so 🙏

# Description
because we already have `null` as the value of the type `nothing` and as
a followup to the two other attempts of mine, i propose to remove the
redundant `$nothing` built-in variable 😋

this PR is the first step, deprecating `$nothing`.
a followup PR will remove it altogether and wait for 0.87 👍 

⚙️ **details**: a new `NOTHING_VARIABLE_ID = 3` has been added,
parsing `$nothing` will create it, finally a `Value::Nothing` will be
produced and a warning will be reported.

this PR already fixes the `toolkit.nu` module so that it does not throw
a bunch of warnings each time 👌

# User-Facing Changes
`$nothing` is now deprecated and will be removed in 0.87
```nushell
> $nothing
Error:   × Deprecated variable
   ╭─[entry #1:1:1]
 1 │ $nothing
   · ────┬───
   ·     ╰── `$nothing` is deprecated and will be removed in 0.87.
   ╰────
  help: Use `null` instead
```

# Tests + Formatting
tests have been updated, especially
- `nothing_fails_string`
- `nothing_fails_int`
which use a variable called `nil` now to make sure `nothing` does not
support cell paths 👍

# After Submitting
classic deprecation mention 👍
hardfau1t pushed a commit to hardfau1t/nushell that referenced this pull request Dec 14, 2023
related to 
- nushell#10478

# Description
this PR is the followup removal to
nushell#10478.

# User-Facing Changes
`$nothing` is now an undefined variable, unless define by the user.
```nushell
> $nothing
Error: nu::parser::variable_not_found

  × Variable not found.
   ╭─[entry #1:1:1]
 1 │ $nothing
   · ────┬───
   ·     ╰── variable not found.
   ╰────
```

# Tests + Formatting

# After Submitting
mention that in release notes
maxim-uvarov pushed a commit to maxim-uvarov/nu_scripts_reduced_size that referenced this pull request Oct 12, 2024
`$nothing` will be deprecated in nu 0.86

This accompanies
- nushell/nushell#10478
maxim-uvarov pushed a commit to maxim-uvarov/nu_scripts_reduced_size that referenced this pull request Oct 13, 2024
`$nothing` will be deprecated in nu 0.86

This accompanies
- nushell/nushell#10478
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category:deprecation Related to the deprecation of commands/features/options notes:mention Include the release notes summary in the "Hall of Fame" section

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants