Skip to content

rename "nothing" type to null#9973

Closed
amtoine wants to merge 16 commits intonushell:mainfrom
amtoine:rename-nothing-type-to-null
Closed

rename "nothing" type to null#9973
amtoine wants to merge 16 commits intonushell:mainfrom
amtoine:rename-nothing-type-to-null

Conversation

@amtoine
Copy link
Copy Markdown
Member

@amtoine amtoine commented Aug 10, 2023

related to

Description

this PR renames the nothing type to null.

User-Facing Changes

nothing should be replaced by null in type annotations, e.g.

def foo []: null -> null {}

instead of

def foo []: nothing -> nothing {}

Tests + Formatting

should not change anything.

After Submitting

@amtoine amtoine added the notes:breaking-changes This PR implies a change affecting users and has to be noted in the release notes label Aug 10, 2023
@amtoine amtoine added semantics Places where we should define/clarify nushell's semantics language A:type-system Problems or features related to nushell's type system labels Aug 10, 2023
@sophiajt sophiajt marked this pull request as draft August 10, 2023 16:33
@sophiajt
Copy link
Copy Markdown
Contributor

@amtoine -

A couple things:

  • this PR is doing more than changing the name of the type to null
  • I made this draft because we haven't decided on the name of the type, yet

@amtoine
Copy link
Copy Markdown
Member Author

amtoine commented Aug 11, 2023

  • this PR is doing more than changing the name of the type to null

i'm not sure i see what it does more 😕
if the type is renamed from nothing to null, i thought having things like Value::Nothing wouldn't make sense anymore and thus renamed them to things like Value::Null 😋

✏️ the real language change is in 53f1a54, the rest is mostly staying consistent and not keeping "nothing"

  • I made this draft because we haven't decided on the name of the type, yet

makes sense, it's just the same PR as #9918 👌

@sophiajt
Copy link
Copy Markdown
Contributor

@amtoine - the value is different from the type, so the PR should only touch the type.

@amtoine
Copy link
Copy Markdown
Member Author

amtoine commented Aug 14, 2023

i see 👍

let's close this and rework it once we decide what we do with the nothing type 😋

amtoine added a commit that referenced this pull request Sep 26, 2023
related to 
- #9973
- #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#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 👍
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A:type-system Problems or features related to nushell's type system notes:breaking-changes This PR implies a change affecting users and has to be noted in the release notes semantics Places where we should define/clarify nushell's semantics

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants