?
u
/
This is the formal specification for a proposed Hack-style pipe
operator |>
in JavaScript. It modifies the original ECMAScript specification with
several new or revised clauses. See the proposal's
explainer for the proposal's background, motivation, and usage examples.
This document presumptively uses %
as the token
for the %
could instead be ^
or some other token.
This section augments the original IsFunctionDefinition clause.
It presumptively uses %
as the placeholder token for the
%
could instead be ^
or some other token.
This section augments the original IsIdentifierRef clause.
It presumptively uses %
as the placeholder token for the
%
could instead be ^
or some other token.
This section is a wholly new sub-clause of the original Contains clause.
Several early error rules for %
.
Any inner
This guarantees that any
Every grammar production alternative in this specification which is not listed below implicitly has the following default definition of ContainsOuterTopic:
%
, return This section augments the original AssignmentTargetType clause.
It presumptively uses %
as the placeholder token for the
%
could instead be ^
or some other token.
This section augments the original Environment Records clause.
Method | Purpose |
---|---|
Determine whether an Environment Record is a
|
This section augments the original Declarative Environment Records clause.
It presumptively uses %
as the placeholder token for the
%
could instead be ^
or some other token.
Declarative Environment Records have the additional state fields
listed in
Method | Value | Purpose |
---|---|---|
[[TopicValues]] | List of any | If the declarative Environment Record is a |
[[TopicValues]] is a List in order to be forward compatible with
future extensions that would use more than one
Declarative Environment Records support all of the abstract methods
of Environment Records listed in
Method | Purpose |
---|---|
BindTopicValues(V) | Establish the immutable |
BindTopicValues accepts a List argument rather than a single-value
argument in order to be forward compatible with future extensions that
would use more than one
The behaviour of the concrete and additional specification methods for declarative Environment Records is defined by the following algorithms.
This section is a wholly new sub-clause of the original Declarative Environment Records clause.
The concrete Environment Record method HasTopicBinding for
declarative Environment Records returns whether the Environment Record
is a
This section is a wholly new sub-clause of the original Declarative Environment Records clause.
The method BindTopicValues for declarative Environment Records may
only be called on an Environment Record when it is not yet a
This section is a wholly new sub-clause of the original Object Environment Records clause.
An Object Environment Record may never have a
This section is a wholly new sub-clause of the original Global Environment Records clause.
A Global Environment Record may never have a
This section is a wholly new sub-clause of the original Environment Records clause.
It presumptively uses %
as the placeholder token for the
%
could instead be ^
or some other token.
The topic binding of a declarative Environment Record
immutably binds the %
to one value of any
ECMAScript language type (called the topic value or simply
the topic), within that declarative Environment Record, at
the time of the Environment Record's instantiation. The topic of a
declarative Environment Record conceptually serves as the value that its
lexical context is "about".
A topic-binding environment is a declarative Environment
Record that establishes a topic binding.
The topic environment of the running execution context is its
LexicalEnvironment's innermost Environment Record that is also a
topic-binding environment (or
An Environment Record is a topic-binding environment
only when it is a declarative Environment Record that
was created by a
This section augments the original Execution Contexts clause.
The abstract operation EvaluateWithTopics takes arguments topicValues (a List) and expression (a Parse Node). It performs the following steps when called:
EvaluateWithTopics creates a new
The abstract operation GetTopicEnvironment takes no arguments. It performs the following steps when called:
GetTopicEnvironment returns the running execution context's
The abstract operation GetPrimaryTopicValue takes no arguments. It performs the following steps when called:
GetPrimaryTopicValue returns the
This section augments the original Punctuators clause.
It presumptively uses %
as the placeholder token for the
%
could instead be ^
or some other token.
This section augments the original Primary Expression clause.
It presumptively uses %
as the placeholder token for the
%
could instead be ^
or some other token.
This section is a wholly new sub-clause to be inserted between the original this
Keyword clause and the original
Identifier Reference clause.
It presumptively uses %
as the placeholder token for the
topic reference. This choice of token is not a final decision; %
could instead be ^
or some other token.
The topic reference, which is the token %
, is a
nullary operator that evaluates to the current Environment Record's
%
is not actually an
The concept of the
An unbound topic reference is a topic reference that
is not present within any %
.
Any inner topic reference within a
This guarantees that every topic reference in a program must be
present within a
A
This section is a wholly new sub-clause to be inserted between the original
Conditional Operator (?
:
) clause and the original
Assignment Operators clause.
This section is a wholly new sub-clause.
It presumptively uses %
as the placeholder token for the
%
could instead be ^
or some other token.
A value |> foo + 1
is an early error,
because
=
&&=
||=
??=
A
This is to prevent confusing expressions from being valid, such as:
x |> yield % |> % + 1 // Syntax Error
This expression would otherwise be equivalent to:
x |> (yield % |> % + 1)
Likewise, this expression:
x |> y ? % : z |> % + 1 // Syntax Error
…would otherwise be equivalent to:
x |> (y ? % : z |> % + 1)
These expressions are visually unclear and are therefore made invalid. The developer may make them valid with explicit parentheses:
x |> (yield %) |> % + 1
x |> (yield % |> % + 1)
x |> (y ? % : z) |> % + 1
x |> (y ? % : z |> % + 1)
This section augments the original Scripts clause.
It presumptively uses %
as the placeholder token for the
%
could instead be ^
or some other token.
An early error rule uses
This guarantees that every
This section augments the original Module Semantics clause.
It presumptively uses %
as the placeholder token for the
%
could instead be ^
or some other token.
An early error rule uses
This guarantees that every
This section augments the original CreateDynamicFunction clause.
It presumptively uses %
as the placeholder token for the
%
could instead be ^
or some other token.
new Function("/*", "*/ ) {")
is not legal.%
.)