-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider changing the term "empty null" to "enumerable null" or "null enumerable" #11175
Comments
It can still confuse. Maybe replace |
It is hard to come up with a descriptive yet pithy term. An alternative would be "null enumerable". The only reason to pick "AutomationNull" would be to align with the underlying type name, which in itself isn't descriptive either. At the end of the day, "AutomationNull" is preferable to "empty null", but given the pending change to create a fully public type - see PowerShell/PowerShell#13465 (comment) - this could be an opportunity to rename the type too; e.g., the implementation could be, based on PowerShell/PowerShell#9997 (comment): namespace System.Management.Automation
{
// New, fully public class
public sealed class NullEnumerable : PSObject
{
private NullEnumerable()
{
}
public static NullEnumerable Value { get; } = new NullEnumerable();
}
}
namespace System.Management.Automation.Internal
{
// Original, "pubternal" class
[Obsolete("Use System.Management.Automation.AutomationNull")]
public static class AutomationNull
{
public static PSObject Value => System.Management.Automation.NullEnumerable.Value;
}
} |
Prior to this change, the article 'Everything you wanted to know about `$null`' used the term 'empty `$null`' to describe `[System.Management.Automation.Internal.AutomationNull]::Value` However, this terminology isn't clear enough, as both that value and the `$null` value itself can be considered to be 'empty.' This change: - Updates to use the terminology 'enumerable null' instead of 'empty `$null`' to describe the value. - Resolves MicrosoftDocs#11175 - Fixes AB#260888
Prior to this change, the article 'Everything you wanted to know about `$null`' used the term 'empty `$null`' to describe `[System.Management.Automation.Internal.AutomationNull]::Value` However, this terminology isn't clear enough, as both that value and the `$null` value itself can be considered to be 'empty.' This change: - Updates to use the terminology 'enumerable null' instead of 'empty `$null`' to describe the value. - Resolves #11175 - Fixes AB#260888
Type of issue
Other (describe below)
Feedback
Suggested terminology change:
[System.Management.Automation.Internal.AutomationNull]::Value
behaves like an enumerable in enumeration contexts.$null
Arguably, either value is "empty", so using "empty null" to describe the former doesn't serve to distinguish these values.
I therefore suggest calling
[System.Management.Automation.Internal.AutomationNull]::Value
the enumerable null or null enumerable (see discussion below).See also:
Default case in Switch not called when variable is in an undefined state PowerShell/PowerShell#21558 (comment)
Enable simple detection of [AutomationNull]::Value with -is [AutomationNull] PowerShell/PowerShell#13465
Page URL
https://learn.microsoft.com/en-us/powershell/scripting/learn/deep-dives/everything-about-null?view=powershell-7.4#empty-null
Content source URL
https://github.com/MicrosoftDocs/PowerShell-Docs/blob/main/reference/docs-conceptual/learn/deep-dives/everything-about-null.md
Author
@sdwheeler
Document Id
53e31d8c-92e1-d484-f9d4-b79ded54c1d1
The text was updated successfully, but these errors were encountered: