Skip to content

Revisiting the name of the term "pattern input value” #1424

@RexJaeschke

Description

@RexJaeschke

In Comment #873 (comment), Nigel mentioned this term and the possible need to change its name. We decided that while it was worth addressing, we'd not have it hold up the adoption of the patterns feature in V8.

Is a value matched/tested against a pattern, or is a pattern matched/tested against a value?

My unscientific guess is value against pattern is the more common usage (including dare I mention in MS web pages), the Standard often goes with pattern against value – though not consistently, the edit below to line 5 changes from “pattern is tested against” to “data … matched against [patterns]”, while line 7 goes with “pattern is tested against”.

Which should the Standard use, or can it be happily inconsistent (variety is after all the spice of life :-))

I will leave you to muse, during review I have so far intentionally not suggested any changes from one to the other, or for consistency – but apologies if my resolve fails! ;-)

Addendum: The term “pattern input value” (emphasis added) is related to this – it is currently defined and used 12 times after in the Standard. Other languages tend to use terms which don’t imply that the value is going “into” the pattern (in the sense an argument value goes into a method). For example F#, a sibling language to C#, has a match expression, similar to C#’s switch expression, and talks about the input to the match, not the input to the pattern.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions