6 ECMAScript 데이터 타입과 값

이 명세 안의 알고리즘은 각각 associated type을 가진 값을 조작합니다. 가능한 값 타입은 정확히 이 절에서 정의된 것들입니다. 타입은 다시 ECMAScript language type과 specification type으로 분류됩니다.

6.1 ECMAScript Language Types

ECMAScript language type은 ECMAScript 프로그래머가 ECMAScript 언어를 사용하여 직접 조작하는 값에 대응합니다. ECMAScript language type은 Undefined, Null, Boolean, String, Symbol, Number, BigInt, Object입니다. ECMAScript language value는 ECMAScript language type으로 특징지어지는 값입니다.

6.1.1 Undefined Type

Undefined type은 정확히 하나의 값을 가지며, 이를 undefined라고 합니다. 값이 할당되지 않은 모든 variable은 undefined 값을 가집니다.

6.1.2 Null Type

Null type은 정확히 하나의 값을 가지며, 이를 null이라고 합니다.

6.1.3 Boolean Type

Boolean typetruefalse라고 불리는 두 값을 가진 logical entity를 나타냅니다.

6.1.4 String Type

String type은 0개 이상의 16-bit unsigned integer value(“elements”)의 ordered sequence 전체의 집합이며, 최대 길이는 253 - 1 elements입니다. String type은 일반적으로 실행 중인 ECMAScript 프로그램에서 textual data를 나타내는 데 사용되며, 이 경우 String 안의 각 element는 UTF-16 code unit value로 취급됩니다. 각 element는 sequence 안의 한 position을 차지하는 것으로 간주됩니다. 이러한 position은 non-negative integer로 indexed됩니다. 첫 번째 element가 있으면 index 0에 있고, 다음 element가 있으면 index 1에 있으며, 이런 식으로 계속됩니다. String의 length는 그 안의 element 수(즉, 16-bit value의 수)입니다. empty String은 length가 zero이므로 element를 포함하지 않습니다.

String contents를 interpret하지 않는 ECMAScript operation은 추가 semantics를 적용하지 않습니다. String value를 interpret하는 operation은 각 element를 단일 UTF-16 code unit으로 취급합니다. 그러나 ECMAScript는 이러한 code unit의 값이나 관계에 제한이나 요구사항을 두지 않으므로, String contents를 UTF-16으로 encoded된 Unicode code point의 sequence로 추가 interpret하는 operation은 ill-formed subsequence를 고려해야 합니다. 이러한 operation은 numeric value가 0xD800부터 0xDBFF까지의 inclusive interval에 있는 모든 code unit(Unicode Standard에서 leading surrogate, 더 형식적으로는 high-surrogate code unit으로 정의됨)과 numeric value가 0xDC00부터 0xDFFF까지의 inclusive interval에 있는 모든 code unit(trailing surrogate, 더 형식적으로는 low-surrogate code unit으로 정의됨)에 대해 다음 규칙을 사용하여 특별한 처리를 적용합니다:

String.prototype.normalize 함수(22.1.3.15 참조)는 String value를 명시적으로 normalize하는 데 사용할 수 있습니다. String.prototype.localeCompare(22.1.3.12 참조)는 내부적으로 String value를 normalize하지만, 다른 operation은 자신이 동작하는 string을 implicitly normalize하지 않습니다. 달리 stated되지 않는 한 operation 결과는 language- 및/또는 locale-sensitive하지 않습니다.

Note

이 설계의 rationale은 String 구현을 가능한 한 simple하고 high-performing하게 유지하기 위한 것이었습니다. ECMAScript source text가 Normalized Form C이면, string literal은 Unicode escape sequence를 포함하지 않는 한 normalized되어 있음이 보장됩니다.

이 명세에서 “A, B, ...의 string-concatenation”이라는 phrase(각 argument가 String value, code unit, 또는 code unit sequence인 경우)는 각 argument의 code unit을 (순서대로) concatenation한 code unit sequence를 가진 String value를 나타냅니다.

inclusiveStart부터 exclusiveEnd까지의 stringsubstring”이라는 phrase(string이 String value 또는 code unit sequence이고 inclusiveStartexclusiveEndinteger인 경우)는 string의 index inclusiveStart에서 시작하여 index exclusiveEnd 바로 앞에서 끝나는 consecutive code unit으로 구성된 String value를 나타냅니다(inclusiveStart = exclusiveEnd인 경우 empty String). "to" suffix가 생략되면 string의 length가 exclusiveEnd 값으로 사용됩니다.

ASCII word characters”라는 phrase는 Unicode Basic Latin block의 모든 letter와 number 및 U+005F(LOW LINE)만으로 구성된 다음 String value를 나타냅니다:
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_".
역사적 이유로, 이는 여러 algorithm에서 의미를 가집니다.

6.1.4.1 StringIndexOf ( string, searchValue, fromIndex )

The abstract operation StringIndexOf takes arguments string (a String), searchValue (a String), and fromIndex (a non-negative integer) and returns a non-negative integer or not-found. It performs the following steps when called:

  1. lengthstring의 length로 둔다.
  2. searchValue가 empty String이고 fromIndexlength이면, fromIndex를 반환한다.
  3. searchLengthsearchValue의 length로 둔다.
  4. fromIndexilength - searchLength인 각 integer i에 대해, ascending order로, 다음을 수행한다.
    1. candidatestringi부터 i + searchLength까지의 substring으로 둔다.
    2. candidatesearchValue이면, i를 반환한다.
  5. not-found를 반환한다.
Note 1

searchValue가 empty String이고 fromIndexstring의 length이면, 이 알고리즘은 fromIndex를 반환합니다. empty String은 string 안의 모든 position에서, 마지막 code unit 뒤를 포함하여, 사실상 found됩니다.

Note 2

fromIndex + searchValue의 length > string의 length이면, 이 알고리즘은 항상 not-found를 반환합니다.

6.1.4.2 StringLastIndexOf ( string, searchValue, fromIndex )

The abstract operation StringLastIndexOf takes arguments string (a String), searchValue (a String), and fromIndex (a non-negative integer) and returns a non-negative integer or not-found. It performs the following steps when called:

  1. lengthstring의 length로 둔다.
  2. searchLengthsearchValue의 length로 둔다.
  3. Assert: fromIndex + searchLengthlength.
  4. 0 ≤ ifromIndex인 각 integer i에 대해, descending order로, 다음을 수행한다.
    1. candidatestringi부터 i + searchLength까지의 substring으로 둔다.
    2. candidatesearchValue이면, i를 반환한다.
  5. not-found를 반환한다.
Note

searchValue가 empty String이면, 이 알고리즘은 fromIndex를 반환합니다. empty String은 string 안의 모든 position에서, 마지막 code unit 뒤를 포함하여, 사실상 found됩니다.

6.1.5 Symbol Type

Symbol type은 Object property의 key로 사용할 수 있는 모든 non-String value의 집합입니다(6.1.7).

각 Symbol은 unique하고 immutable합니다.

각 Symbol은 값이 String 또는 undefined인 immutable [[Description]] internal slot을 가집니다.

6.1.5.1 Well-Known Symbols

Well-known symbol은 이 명세의 algorithm에서 명시적으로 참조되는 built-in Symbol value입니다. 보통 specification algorithm의 extension point 역할을 하는 value를 가진 property의 key로 사용됩니다. 달리 specified되지 않는 한, well-known symbol value는 모든 realm이 공유합니다(9.3).

이 명세 안에서 well-known symbol은 Table 1에 나열된 값 중 하나인 intrinsic을 사용하는 표준 intrinsic notation으로 지칭됩니다.

Note
이 명세의 이전 판들은 @@name 형식의 notation을 사용했으며, 현재 판에서는 %Symbol.name%을 사용합니다. 특히 다음 이름들이 사용되었습니다: @@asyncIterator, @@hasInstance, @@isConcatSpreadable, @@iterator, @@match, @@matchAll, @@replace, @@search, @@species, @@split, @@toPrimitive, @@toStringTag, and @@unscopables.
Table 1: 잘 알려진 심벌
명세 이름 [[Description]] 값과 목적
%Symbol.asyncDispose% "Symbol.asyncDispose" 객체에 대해 리소스 정리를 비동기적으로 수행하는 메서드. 포함하는 스코프의 평가가 완료될 때 AsyncDisposableStack 객체와 await using 선언에 의해 호출된다.
%Symbol.asyncIterator% "Symbol.asyncIterator" 객체의 기본 비동기 반복자를 반환하는 메서드. for-await-of 문의 의미론에 의해 호출된다.
%Symbol.dispose% "Symbol.dispose" 객체에 대해 명시적 리소스 정리를 수행하는 메서드. 포함하는 스코프의 평가가 완료될 때 DisposableStack 객체, AsyncDisposableStack 객체 및 using 선언에 의해 호출된다.
%Symbol.hasInstance% "Symbol.hasInstance" 생성자 객체가 어떤 객체를 해당 생성자의 인스턴스 중 하나로 인식하는지 결정하는 메서드. instanceof 연산자의 의미론에 의해 호출된다.
%Symbol.isConcatSpreadable% "Symbol.isConcatSpreadable" true이면 객체가 Array.prototype.concat에 의해 그 배열 요소로 평탄화되어야 함을 나타내는 Boolean 값 속성.
%Symbol.iterator% "Symbol.iterator" 객체의 기본 반복자를 반환하는 메서드. for-of 문의 의미론에 의해 호출된다.
%Symbol.match% "Symbol.match" 정규 표현식을 문자열과 대조하여 일치시키는 정규 표현식 메서드. String.prototype.match 메서드에 의해 호출된다.
%Symbol.matchAll% "Symbol.matchAll" 정규 표현식을 문자열과 대조한 일치 항목을 산출하는 반복자를 반환하는 정규 표현식 메서드. String.prototype.matchAll 메서드에 의해 호출된다.
%Symbol.replace% "Symbol.replace" 문자열에서 일치한 부분 문자열을 대체하는 정규 표현식 메서드. String.prototype.replace 메서드에 의해 호출된다.
%Symbol.search% "Symbol.search" 정규 표현식과 일치하는 문자열 내 인덱스를 반환하는 정규 표현식 메서드. String.prototype.search 메서드에 의해 호출된다.
%Symbol.species% "Symbol.species" 파생 객체를 생성하는 데 사용되는 생성자 함수인 함수 값 속성.
%Symbol.split% "Symbol.split" 정규 표현식과 일치하는 인덱스에서 문자열을 분할하는 정규 표현식 메서드. String.prototype.split 메서드에 의해 호출된다.
%Symbol.toPrimitive% "Symbol.toPrimitive" 객체를 대응하는 원시 값으로 변환하는 메서드. ToPrimitive 추상 연산에 의해 호출된다.
%Symbol.toStringTag% "Symbol.toStringTag" 객체의 기본 문자열 설명을 생성할 때 사용되는 String 값 속성. 내장 메서드 Object.prototype.toString에 의해 접근된다.
%Symbol.unscopables% "Symbol.unscopables" 자체 및 상속된 속성 이름이 연결된 객체의 with 환경 바인딩에서 제외되는 속성 이름인 객체 값 속성.

6.1.6 Numeric Types

ECMAScript에는 두 built-in numeric type이 있습니다: Number와 BigInt. 다음 abstract operation은 이러한 numeric type 위에서 정의됩니다. “Result” column은 return type을 보여주며, operation의 일부 invocation이 abrupt completion을 반환할 수 있는지도 함께 나타냅니다.

Table 2: Numeric Type Operations
Operation Example source ...의 Evaluation semantics에 의해 Invoked Result
Number::unaryMinus -x Unary - Operator Number
BigInt::unaryMinus BigInt
Number::bitwiseNOT ~x Bitwise NOT Operator ( ~ ) Number
BigInt::bitwiseNOT BigInt
Number::exponentiate x ** y Exponentiation OperatorMath.pow ( base, exponent ) Number
BigInt::exponentiate BigInt를 포함하는 normal completion 또는 throw completion
Number::multiply x * y Multiplicative Operators Number
BigInt::multiply BigInt
Number::divide x / y Multiplicative Operators Number
BigInt::divide BigInt를 포함하는 normal completion 또는 throw completion
Number::remainder x % y Multiplicative Operators Number
BigInt::remainder BigInt를 포함하는 normal completion 또는 throw completion
Number::add x ++
++ x
x + y
Postfix Increment Operator, Prefix Increment Operator, 및 Addition Operator ( + ) Number
BigInt::add BigInt
Number::subtract x --
-- x
x - y
Postfix Decrement Operator, Prefix Decrement Operator, 및 Subtraction Operator ( - ) Number
BigInt::subtract BigInt
Number::leftShift x << y Left Shift Operator ( << ) Number
BigInt::leftShift BigInt
Number::signedRightShift x >> y Signed Right Shift Operator ( >> ) Number
BigInt::signedRightShift BigInt
Number::unsignedRightShift x >>> y Unsigned Right Shift Operator ( >>> ) Number
BigInt::unsignedRightShift throw completion
Number::lessThan x < y
x > y
x <= y
x >= y
Relational Operators, via IsLessThan ( x, y, leftFirst ) Boolean 또는 undefined (unordered input의 경우)
BigInt::lessThan Boolean
Number::equal x == y
x != y
x === y
x !== y
Equality Operators, via IsStrictlyEqual ( x, y ) Boolean
BigInt::equal
Number::sameValue Object.is(x, y) Object internal method, via SameValue ( x, y ), exact value equality를 test하기 위해 Boolean
Number::sameValueZero [x].includes(y) via SameValueZero ( x, y ), Array, Map, Set method에서처럼 +0𝔽-0𝔽의 차이를 무시하고 value equality를 test하기 위해 Boolean
Number::bitwiseAND x & y Binary Bitwise Operators Number
BigInt::bitwiseAND BigInt
Number::bitwiseXOR x ^ y Number
BigInt::bitwiseXOR BigInt
Number::bitwiseOR x | y Number
BigInt::bitwiseOR BigInt
Number::toString String(x) 많은 expression과 built-in function, via ToString ( arg ) String
BigInt::toString

numeric type은 일반적으로 precision loss 또는 truncation 없이 convert될 수 없으므로, ECMAScript 언어는 이러한 type 사이의 implicit conversion을 제공하지 않습니다. 다른 type을 요구하는 function을 호출할 때 type 간 convert를 하려면, 프로그래머는 NumberBigInt function을 명시적으로 호출해야 합니다.

Note

ECMAScript의 초판과 이후 판들은 특정 operator에 대해 precision을 잃거나 truncate될 수 있는 implicit numeric conversion을 제공해 왔습니다. 이러한 legacy implicit conversion은 backward compatibility를 위해 유지되지만, programmer error의 가능성을 최소화하고 향후 판에서 generalized value types의 선택지를 열어두기 위해 BigInt에는 제공되지 않습니다.

6.1.6.1 Number Type

Number type은 정확히 18,437,736,874,454,810,627개(즉, 264 - 253 + 3)의 값을 가지며, IEEE Standard for Binary Floating-Point Arithmetic에 명시된 double-precision floating point IEEE 754-2019 binary64 값을 나타냅니다. 다만 IEEE Standard의 9,007,199,254,740,990개(즉, 253 - 2) distinct NaN 값은 ECMAScript에서 하나의 special NaN value로 표현됩니다. (주의: NaN value는 program expression NaN에 의해 생성됩니다.) 일부 implementation에서는 external code가 여러 NaN value 사이의 차이를 detect할 수 있을 수 있지만, 그러한 behaviour는 implementation-defined입니다. ECMAScript code에서는 모든 NaN value가 서로 indistinguishable합니다.

Note

Number value가 ArrayBuffer(25.1 참조) 또는 SharedArrayBuffer(25.2 참조)에 저장된 뒤 관찰될 수 있는 bit pattern은 ECMAScript implementation이 사용하는 그 Number value의 internal representation과 반드시 같지는 않습니다.

positive Infinitynegative Infinity라고 불리는 두 special value가 더 있습니다. 간결함을 위해, 이 값들은 설명 목적상 각각 +∞𝔽-∞𝔽 symbol로도 지칭됩니다. (주의: 이 두 infinite Number value는 program expression +Infinity(또는 간단히 Infinity)와 -Infinity에 의해 생성됩니다.)

다른 18,437,736,874,454,810,624개(즉, 264 - 253)의 값은 finite number라고 불립니다. 이 중 절반은 positive number이고 절반은 negative number입니다. 모든 finite positive Number value에 대해 같은 magnitude를 가진 대응하는 negative value가 있습니다.

positive zeronegative zero가 모두 있다는 점에 유의하십시오. 간결함을 위해, 이 값들은 설명 목적상 각각 +0𝔽-0𝔽 symbol로도 지칭됩니다. (주의: 이 두 다른 zero Number value는 program expression +0(또는 간단히 0)와 -0에 의해 생성됩니다.)

18,437,736,874,454,810,622개(즉, 264 - 253 - 2)의 finite non-zero value는 두 종류입니다:

그중 18,428,729,675,200,069,632개(즉, 264 - 254)는 normalized이며, 다음 형식을 가집니다

s × m × 2e

여기서 s는 1 또는 -1이고, m은 252(inclusive)부터 253(exclusive)까지의 interval에 있는 integer이며, e는 -1074부터 971까지의 inclusive interval에 있는 integer입니다.

나머지 9,007,199,254,740,990개(즉, 253 - 2)의 값은 denormalized이며, 다음 형식을 가집니다

s × m × 2e

여기서 s는 1 또는 -1이고, m은 0(exclusive)부터 252(exclusive)까지의 interval에 있는 integer이며, e는 -1074입니다.

magnitude가 253보다 크지 않은 모든 positive 및 negative integer는 Number type에서 representable하다는 점에 유의하십시오. integer 0은 Number type에서 두 representation을 가집니다: +0𝔽-0𝔽.

finite number가 non-zero이고 위에 표시된 두 형식 중 하나로 표현하는 데 사용된 integer m이 odd이면, 이는 odd significand를 가집니다. 그렇지 않으면 even significand를 가집니다.

이 명세에서 “x에 대한 Number value for”라는 phrase에서 x가 exact real mathematical quantity(π와 같은 irrational number일 수도 있음)를 나타낼 때, 이는 다음 방식으로 선택된 Number value를 의미합니다. Number type의 모든 finite value의 집합에서 -0𝔽를 제거하고, Number type에서 representable하지 않는 두 additional value, 즉 21024(이는 +1 × 253 × 2971)와 -21024(이는 -1 × 253 × 2971)를 추가한 집합을 고려합니다. 이 집합의 member 중 x에 가장 가까운 값을 선택합니다. 집합의 두 값이 equally close이면, even significand를 가진 것을 선택합니다. 이 목적상 두 extra value 21024-21024는 even significand를 가진 것으로 간주됩니다. 마지막으로 21024가 선택되었으면 이를 +∞𝔽로 replace합니다. -21024가 선택되었으면 이를 -∞𝔽로 replace합니다. +0𝔽가 선택되었으면 x < 0인 경우에만 이를 -0𝔽로 replace합니다. 그 밖의 선택된 값은 unchanged로 사용됩니다. 그 결과가 x에 대한 Number value입니다. (이 절차는 IEEE 754-2019 roundTiesToEven mode의 behaviour와 정확히 대응합니다.)

+∞에 대한 Number value는 +∞𝔽이고, -∞에 대한 Number value는 -∞𝔽입니다.

일부 ECMAScript operator는 -231부터 231 - 1까지의 inclusive interval이나 0부터 216 - 1까지의 inclusive interval과 같은 특정 range의 integer만 다룹니다. 이러한 operator는 Number type의 어떤 값이든 accept하지만 먼저 그러한 각 값을 expected range의 integer value로 convert합니다. 7.1의 numeric conversion operation 설명을 참조하십시오.

6.1.6.1.1 Number::unaryMinus ( number )

The abstract operation Number::unaryMinus takes argument number (a Number) and returns a Number. It performs the following steps when called:

  1. numberNaN이면, NaN을 반환한다.
  2. number의 negation을 반환한다. 즉, 같은 magnitude이지만 opposite sign을 가진 Number를 계산한다.

6.1.6.1.2 Number::bitwiseNOT ( number )

The abstract operation Number::bitwiseNOT takes argument number (a Number) and returns an integral Number. It performs the following steps when called:

  1. oldValue를 ! ToInt32(number)로 둔다.
  2. oldValue의 bitwise complement를 반환한다. 결과의 mathematical value는 32-bit two's complement bit string으로 정확히 representable하다.

6.1.6.1.3 Number::exponentiate ( base, exponent )

The abstract operation Number::exponentiate takes arguments base (a Number) and exponent (a Number) and returns a Number. baseexponent power로 올린 결과를 나타내는 implementation-approximated value를 반환합니다. It performs the following steps when called:

  1. exponentNaN이면, NaN을 반환한다.
  2. exponent+0𝔽 또는 -0𝔽이면, 1𝔽를 반환한다.
  3. baseNaN이면, NaN을 반환한다.
  4. base+∞𝔽이면, 다음을 수행한다.
    1. exponent > +0𝔽이면, +∞𝔽를 반환한다.
    2. +0𝔽를 반환한다.
  5. base-∞𝔽이면, 다음을 수행한다.
    1. exponent > +0𝔽이면, 다음을 수행한다.
      1. exponent가 odd integral Number이면, -∞𝔽를 반환한다.
      2. +∞𝔽를 반환한다.
    2. exponent가 odd integral Number이면, -0𝔽를 반환한다.
    3. +0𝔽를 반환한다.
  6. base+0𝔽이면, 다음을 수행한다.
    1. exponent > +0𝔽이면, +0𝔽를 반환한다.
    2. +∞𝔽를 반환한다.
  7. base-0𝔽이면, 다음을 수행한다.
    1. exponent > +0𝔽이면, 다음을 수행한다.
      1. exponent가 odd integral Number이면, -0𝔽를 반환한다.
      2. +0𝔽를 반환한다.
    2. exponent가 odd integral Number이면, -∞𝔽를 반환한다.
    3. +∞𝔽를 반환한다.
  8. Assert: basefinite이고 +0𝔽-0𝔽도 아니다.
  9. exponent+∞𝔽이면, 다음을 수행한다.
    1. abs((base)) > 1이면, +∞𝔽를 반환한다.
    2. abs((base)) = 1이면, NaN을 반환한다.
    3. +0𝔽를 반환한다.
  10. exponent-∞𝔽이면, 다음을 수행한다.
    1. abs((base)) > 1이면, +0𝔽를 반환한다.
    2. abs((base)) = 1이면, NaN을 반환한다.
    3. +∞𝔽를 반환한다.
  11. Assert: exponentfinite이고 +0𝔽-0𝔽도 아니다.
  12. base < -0𝔽이고 exponentintegral Number가 아니면, NaN을 반환한다.
  13. (base)를 (exponent) power로 올린 결과를 나타내는 implementation-approximated Number value를 반환한다.
Note

base1𝔽 또는 -1𝔽이고 exponent+∞𝔽 또는 -∞𝔽일 때, 또는 base1𝔽이고 exponentNaN일 때의 base ** exponent 결과는 IEEE 754-2019와 다릅니다. ECMAScript 초판은 이 operation의 결과를 NaN으로 명시했지만, 이후 IEEE 754 개정판은 1𝔽를 명시했습니다. 역사적 ECMAScript behaviour는 compatibility 이유로 보존됩니다.

6.1.6.1.4 Number::multiply ( x, y )

The abstract operation Number::multiply takes arguments x (a Number) and y (a Number) and returns a Number. IEEE 754-2019 binary double-precision arithmetic의 규칙에 따라 multiplication을 수행하여 xy의 product를 생성합니다. It performs the following steps when called:

  1. xNaN이거나 yNaN이면, NaN을 반환한다.
  2. x+∞𝔽 또는 -∞𝔽이면, 다음을 수행한다.
    1. y+0𝔽 또는 -0𝔽이면, NaN을 반환한다.
    2. y > +0𝔽이면, x를 반환한다.
    3. -x를 반환한다.
  3. y+∞𝔽 또는 -∞𝔽이면, 다음을 수행한다.
    1. x+0𝔽 또는 -0𝔽이면, NaN을 반환한다.
    2. x > +0𝔽이면, y를 반환한다.
    3. -y를 반환한다.
  4. x-0𝔽이면, 다음을 수행한다.
    1. y-0𝔽이거나 y < -0𝔽이면, +0𝔽를 반환한다.
    2. -0𝔽를 반환한다.
  5. y-0𝔽이면, 다음을 수행한다.
    1. x < -0𝔽이면, +0𝔽를 반환한다.
    2. -0𝔽를 반환한다.
  6. 𝔽((x) × (y))를 반환한다.
Note

Finite-precision multiplication은 commutative이지만, 항상 associative인 것은 아닙니다.

6.1.6.1.5 Number::divide ( x, y )

The abstract operation Number::divide takes arguments x (a Number) and y (a Number) and returns a Number. IEEE 754-2019 binary double-precision arithmetic의 규칙에 따라 division을 수행하여, x가 dividend이고 y가 divisor인 xy의 quotient를 생성합니다. It performs the following steps when called:

  1. xNaN이거나 yNaN이면, NaN을 반환한다.
  2. x+∞𝔽 또는 -∞𝔽이면, 다음을 수행한다.
    1. y+∞𝔽 또는 -∞𝔽이면, NaN을 반환한다.
    2. y+0𝔽이거나 y > +0𝔽이면, x를 반환한다.
    3. -x를 반환한다.
  3. y+∞𝔽이면, 다음을 수행한다.
    1. x+0𝔽이거나 x > +0𝔽이면, +0𝔽를 반환한다.
    2. -0𝔽를 반환한다.
  4. y-∞𝔽이면, 다음을 수행한다.
    1. x+0𝔽이거나 x > +0𝔽이면, -0𝔽를 반환한다.
    2. +0𝔽를 반환한다.
  5. x+0𝔽 또는 -0𝔽이면, 다음을 수행한다.
    1. y+0𝔽 또는 -0𝔽이면, NaN을 반환한다.
    2. y > +0𝔽이면, x를 반환한다.
    3. -x를 반환한다.
  6. y+0𝔽이면, 다음을 수행한다.
    1. x > +0𝔽이면, +∞𝔽를 반환한다.
    2. -∞𝔽를 반환한다.
  7. y-0𝔽이면, 다음을 수행한다.
    1. x > +0𝔽이면, -∞𝔽를 반환한다.
    2. +∞𝔽를 반환한다.
  8. 𝔽((x) / (y))를 반환한다.

6.1.6.1.6 Number::remainder ( numerator, denominator )

The abstract operation Number::remainder takes arguments numerator (a Number) and denominator (a Number) and returns a Number. numerator가 dividend이고 denominator가 divisor인 operand의 implied division에서 remainder를 산출합니다. It performs the following steps when called:

  1. numeratorNaN이거나 denominatorNaN이면, NaN을 반환한다.
  2. numerator+∞𝔽 또는 -∞𝔽이면, NaN을 반환한다.
  3. denominator+∞𝔽 또는 -∞𝔽이면, numerator를 반환한다.
  4. denominator+0𝔽 또는 -0𝔽이면, NaN을 반환한다.
  5. numerator+0𝔽 또는 -0𝔽이면, numerator를 반환한다.
  6. Assert: numeratordenominatorfinite이고 non-zero이다.
  7. quotient(numerator) / (denominator)로 둔다.
  8. truncatedQuotienttruncate(quotient)로 둔다.
  9. remainder(numerator) - ((denominator) × truncatedQuotient)로 둔다.
  10. remainder = 0이고 numerator < -0𝔽이면, -0𝔽를 반환한다.
  11. 𝔽(remainder)를 반환한다.
Note 1

C와 C++에서 remainder operator는 integral operand만 accept합니다. ECMAScript에서는 floating-point operand도 accept합니다.

Note 2
% operator로 계산되는 floating-point remainder operation의 결과는 IEEE 754-2019가 정의하는 “remainder” operation과 같지 않습니다. IEEE 754-2019 “remainder” operation은 truncating division이 아니라 rounding division에서 remainder를 계산하므로, 그 behaviour는 일반적인 integer remainder operator의 behaviour와 analogous하지 않습니다. 대신 ECMAScript 언어는 floating-point operation에서 %가 Java integer remainder operator와 analogous한 방식으로 behave하도록 정의합니다. 이는 C library function fmod와 비교될 수 있습니다.

6.1.6.1.7 Number::add ( x, y )

The abstract operation Number::add takes arguments x (a Number) and y (a Number) and returns a Number. IEEE 754-2019 binary double-precision arithmetic의 규칙에 따라 addition을 수행하여 argument의 sum을 생성합니다. It performs the following steps when called:

  1. xNaN이거나 yNaN이면, NaN을 반환한다.
  2. x+∞𝔽이고 y-∞𝔽이면, NaN을 반환한다.
  3. x-∞𝔽이고 y+∞𝔽이면, NaN을 반환한다.
  4. x+∞𝔽 또는 -∞𝔽이면, x를 반환한다.
  5. y+∞𝔽 또는 -∞𝔽이면, y를 반환한다.
  6. Assert: xy는 둘 다 finite이다.
  7. x-0𝔽이고 y-0𝔽이면, -0𝔽를 반환한다.
  8. 𝔽((x) + (y))를 반환한다.
Note

Finite-precision addition은 commutative이지만, 항상 associative인 것은 아닙니다.

6.1.6.1.8 Number::subtract ( x, y )

The abstract operation Number::subtract takes arguments x (a Number) and y (a Number) and returns a Number. subtraction을 수행하여 operand의 difference를 생성합니다. x는 minuend이고 y는 subtrahend입니다. It performs the following steps when called:

  1. Number::add(x, Number::unaryMinus(y))를 반환한다.
Note

x - y는 항상 x + (-y)와 같은 결과를 생성합니다.

6.1.6.1.9 Number::leftShift ( x, y )

The abstract operation Number::leftShift takes arguments x (a Number) and y (a Number) and returns an integral Number. It performs the following steps when called:

  1. leftNumber를 ! ToInt32(x)로 둔다.
  2. rightNumber를 ! ToUint32(y)로 둔다.
  3. shiftCount(rightNumber) modulo 32로 둔다.
  4. leftNumbershiftCount bit만큼 left shifting한 결과를 반환한다. 결과의 mathematical value는 32-bit two's complement bit string으로 정확히 representable하다.

6.1.6.1.10 Number::signedRightShift ( x, y )

The abstract operation Number::signedRightShift takes arguments x (a Number) and y (a Number) and returns an integral Number. It performs the following steps when called:

  1. leftNumber를 ! ToInt32(x)로 둔다.
  2. rightNumber를 ! ToUint32(y)로 둔다.
  3. shiftCount(rightNumber) modulo 32로 둔다.
  4. leftNumbershiftCount bit만큼 sign-extending right shift한 결과를 반환한다. most significant bit가 propagated된다. 결과의 mathematical value는 32-bit two's complement bit string으로 정확히 representable하다.

6.1.6.1.11 Number::unsignedRightShift ( x, y )

The abstract operation Number::unsignedRightShift takes arguments x (a Number) and y (a Number) and returns an integral Number. It performs the following steps when called:

  1. leftNumber를 ! ToUint32(x)로 둔다.
  2. rightNumber를 ! ToUint32(y)로 둔다.
  3. shiftCount(rightNumber) modulo 32로 둔다.
  4. leftNumbershiftCount bit만큼 zero-filling right shift한 결과를 반환한다. 비워진 bit는 zero로 채워진다. 결과의 mathematical value는 32-bit unsigned bit string으로 정확히 representable하다.

6.1.6.1.12 Number::lessThan ( x, y )

The abstract operation Number::lessThan takes arguments x (a Number) and y (a Number) and returns a Boolean or undefined. It performs the following steps when called:

  1. xNaN이면, undefined를 반환한다.
  2. yNaN이면, undefined를 반환한다.
  3. xy이면, false를 반환한다.
  4. x+0𝔽이고 y-0𝔽이면, false를 반환한다.
  5. x-0𝔽이고 y+0𝔽이면, false를 반환한다.
  6. x+∞𝔽이면, false를 반환한다.
  7. y+∞𝔽이면, true를 반환한다.
  8. y-∞𝔽이면, false를 반환한다.
  9. x-∞𝔽이면, true를 반환한다.
  10. Assert: xyfinite이다.
  11. (x) < (y)이면, true를 반환한다.
  12. false를 반환한다.

6.1.6.1.13 Number::equal ( x, y )

The abstract operation Number::equal takes arguments x (a Number) and y (a Number) and returns a Boolean. It performs the following steps when called:

  1. xNaN이면, false를 반환한다.
  2. yNaN이면, false를 반환한다.
  3. xy이면, true를 반환한다.
  4. x+0𝔽이고 y-0𝔽이면, true를 반환한다.
  5. x-0𝔽이고 y+0𝔽이면, true를 반환한다.
  6. false를 반환한다.

6.1.6.1.14 Number::sameValue ( x, y )

The abstract operation Number::sameValue takes arguments x (a Number) and y (a Number) and returns a Boolean. It performs the following steps when called:

  1. xNaN이고 yNaN이면, true를 반환한다.
  2. x+0𝔽이고 y-0𝔽이면, false를 반환한다.
  3. x-0𝔽이고 y+0𝔽이면, false를 반환한다.
  4. xy이면, true를 반환한다.
  5. false를 반환한다.

6.1.6.1.15 Number::sameValueZero ( x, y )

The abstract operation Number::sameValueZero takes arguments x (a Number) and y (a Number) and returns a Boolean. It performs the following steps when called:

  1. xNaN이고 yNaN이면, true를 반환한다.
  2. x+0𝔽이고 y-0𝔽이면, true를 반환한다.
  3. x-0𝔽이고 y+0𝔽이면, true를 반환한다.
  4. xy이면, true를 반환한다.
  5. false를 반환한다.

6.1.6.1.16 NumberBitwiseOp ( op, x, y )

The abstract operation NumberBitwiseOp takes arguments op (&, ^, or |), x (a Number), and y (a Number) and returns an integral Number. It performs the following steps when called:

  1. leftNumber를 ! ToInt32(x)로 둔다.
  2. rightNumber를 ! ToInt32(y)로 둔다.
  3. leftBits(leftNumber)를 나타내는 32-bit two's complement bit string으로 둔다.
  4. rightBits(rightNumber)를 나타내는 32-bit two's complement bit string으로 둔다.
  5. op&이면, 다음을 수행한다.
    1. resultleftBitsrightBits에 bitwise AND operation을 적용한 결과로 둔다.
  6. 그렇지 않고 op^이면, 다음을 수행한다.
    1. resultleftBitsrightBits에 bitwise exclusive OR (XOR) operation을 적용한 결과로 둔다.
  7. 그렇지 않으면,
    1. Assert: op|이다.
    2. resultleftBitsrightBits에 bitwise inclusive OR operation을 적용한 결과로 둔다.
  8. 32-bit two's complement bit string result가 나타내는 integer에 대한 Number value를 반환한다.

6.1.6.1.17 Number::bitwiseAND ( x, y )

The abstract operation Number::bitwiseAND takes arguments x (a Number) and y (a Number) and returns an integral Number. It performs the following steps when called:

  1. NumberBitwiseOp(&, x, y)를 반환한다.

6.1.6.1.18 Number::bitwiseXOR ( x, y )

The abstract operation Number::bitwiseXOR takes arguments x (a Number) and y (a Number) and returns an integral Number. It performs the following steps when called:

  1. NumberBitwiseOp(^, x, y)를 반환한다.

6.1.6.1.19 Number::bitwiseOR ( x, y )

The abstract operation Number::bitwiseOR takes arguments x (a Number) and y (a Number) and returns an integral Number. It performs the following steps when called:

  1. NumberBitwiseOp(|, x, y)를 반환한다.

6.1.6.1.20 Number::toString ( x, radix )

The abstract operation Number::toString takes arguments x (a Number) and radix (an integer in the inclusive interval from 2 to 36) and returns a String. radix를 radix로 하는 positional numeral system을 사용하여 x를 String으로 나타냅니다. radix r을 사용한 number representation에서 사용되는 digit은 "0123456789abcdefghijklmnopqrstuvwxyz"의 처음 r code unit에서 순서대로 가져옵니다. magnitude가 1𝔽 이상인 number의 representation은 leading zero를 결코 포함하지 않습니다. It performs the following steps when called:

  1. xNaN이면, "NaN"을 반환한다.
  2. x+0𝔽 또는 -0𝔽이면, "0"을 반환한다.
  3. x < -0𝔽이면, "-"Number::toString(-x, radix)의 string-concatenation을 반환한다.
  4. x+∞𝔽이면, "Infinity"를 반환한다.
  5. n, k, s를 다음을 만족하는 integer로 둔다: k ≥ 1, radixk - 1s < radixk, 𝔽(s × radixn - k)가 x이고, k는 가능한 한 작다. k는 radix radix를 사용한 s의 representation에서 digit 수이고, sradix로 divisible하지 않으며, s의 least significant digit은 이러한 criteria에 의해 반드시 uniquely determined되는 것은 아니라는 점에 유의한다.
  6. radix ≠ 10이거나 n이 -5부터 21까지의 inclusive interval 안에 있으면, 다음을 수행한다.
    1. nk이면, 다음을 수행한다.
      1. 다음의 string-concatenation을 반환한다:
        • radix radix를 사용한 s의 representation에서 k digit의 code unit
        • code unit 0x0030 (DIGIT ZERO)의 n - k occurrences
    2. n > 0이면, 다음을 수행한다.
      1. 다음의 string-concatenation을 반환한다:
        • radix radix를 사용한 s의 representation에서 most significant n digit의 code unit
        • code unit 0x002E (FULL STOP)
        • radix radix를 사용한 s의 representation에서 remaining k - n digit의 code unit
    3. Assert: n ≤ 0.
    4. 다음의 string-concatenation을 반환한다:
      • code unit 0x0030 (DIGIT ZERO)
      • code unit 0x002E (FULL STOP)
      • code unit 0x0030 (DIGIT ZERO)의 -n occurrences
      • radix radix를 사용한 s의 representation에서 k digit의 code unit
  7. NOTE: 이 경우 input은 1.2e+3과 같은 scientific E notation을 사용하여 represented된다.
  8. Assert: radix는 10이다.
  9. n < 0이면, 다음을 수행한다.
    1. exponentSign을 code unit 0x002D (HYPHEN-MINUS)로 둔다.
  10. 그렇지 않으면,
    1. exponentSign을 code unit 0x002B (PLUS SIGN)로 둔다.
  11. k = 1이면, 다음을 수행한다.
    1. 다음의 string-concatenation을 반환한다:
      • s의 single digit의 code unit
      • code unit 0x0065 (LATIN SMALL LETTER E)
      • exponentSign
      • abs(n - 1)의 decimal representation의 code unit
  12. 다음의 string-concatenation을 반환한다:
    • s의 decimal representation에서 most significant digit의 code unit
    • code unit 0x002E (FULL STOP)
    • s의 decimal representation에서 remaining k - 1 digit의 code unit
    • code unit 0x0065 (LATIN SMALL LETTER E)
    • exponentSign
    • abs(n - 1)의 decimal representation의 code unit
Note 1

다음 observations는 implementation을 위한 guideline으로 유용할 수 있지만, 이 표준의 normative requirement의 일부는 아닙니다:

  • x가 -0𝔽 이외의 어떤 Number value이면, ToNumber(ToString(x))는 x입니다.
  • s의 least significant digit은 step 5에 나열된 requirements에 의해 항상 uniquely determined되는 것은 아닙니다.
Note 2

위 규칙이 요구하는 것보다 더 정확한 conversion을 제공하는 implementation의 경우, step 5의 다음 alternative version을 guideline으로 사용할 것을 권장합니다:

  1. n, k, s를 다음을 만족하는 integer로 둔다: k ≥ 1, radixk - 1s < radixk, 𝔽(s × radixn - k)가 x이고, k는 가능한 한 작다. s에 대해 여러 가능성이 있으면, s × radixn - k(x)에 가장 가까운 s를 선택한다. 그러한 가능한 s 값이 두 개 있으면, even인 것을 선택한다. k는 radix radix를 사용한 s의 representation에서 digit 수이며 sradix로 divisible하지 않는다는 점에 유의한다.
Note 3

ECMAScript implementer는 floating-point number의 binary-to-decimal conversion에 대해 David M. Gay가 작성한 논문과 code가 유용할 수 있습니다:

Gay, David M. Correctly Rounded Binary-Decimal and Decimal-Binary Conversions. Numerical Analysis, Manuscript 90-10. AT&T Bell Laboratories (Murray Hill, New Jersey). 30 November 1990. Available as
https://ampl.com/_archive/first-website/REFS/rounding.pdf. Associated code available as
http://netlib.sandia.gov/fp/dtoa.c and as
http://netlib.sandia.gov/fp/g_fmt.c and may also be found at the various netlib mirror sites.

6.1.6.2 BigInt Type

BigInt typeinteger value를 나타냅니다. 값은 어떤 size도 될 수 있으며 특정 bit-width로 제한되지 않습니다. 일반적으로 달리 noted되지 않은 곳에서 operation은 exact mathematically-based answer를 반환하도록 설계됩니다. binary operation의 경우, BigInt는 two's complement binary string처럼 동작하며, negative number는 왼쪽으로 infinite하게 bit가 set된 것으로 취급됩니다.

6.1.6.2.1 BigInt::unaryMinus ( bigint )

The abstract operation BigInt::unaryMinus takes argument bigint (a BigInt) and returns a BigInt. It performs the following steps when called:

  1. bigint = 0이면, 0를 반환한다.
  2. -bigint를 반환한다.

6.1.6.2.2 BigInt::bitwiseNOT ( bigint )

The abstract operation BigInt::bitwiseNOT takes argument bigint (a BigInt) and returns a BigInt. bigint의 one's complement를 반환합니다. It performs the following steps when called:

  1. -bigint - 1를 반환한다.

6.1.6.2.3 BigInt::exponentiate ( base, exponent )

The abstract operation BigInt::exponentiate takes arguments base (a BigInt) and exponent (a BigInt) and returns either a normal completion containing a BigInt or a throw completion. It performs the following steps when called:

  1. exponent < 0이면, RangeError exception을 throw한다.
  2. base = 0이고 exponent = 0이면, 1를 반환한다.
  3. base raised to the power exponent를 반환한다.

6.1.6.2.4 BigInt::multiply ( x, y )

The abstract operation BigInt::multiply takes arguments x (a BigInt) and y (a BigInt) and returns a BigInt. It performs the following steps when called:

  1. x × y를 반환한다.
Note
결과가 input보다 훨씬 더 큰 bit width를 가지더라도, exact mathematical answer가 제공됩니다.

6.1.6.2.5 BigInt::divide ( x, y )

The abstract operation BigInt::divide takes arguments x (a BigInt) and y (a BigInt) and returns either a normal completion containing a BigInt or a throw completion. It performs the following steps when called:

  1. y = 0이면, RangeError exception을 throw한다.
  2. quotient(x) / (y)로 둔다.
  3. (truncate(quotient))를 반환한다.

6.1.6.2.6 BigInt::remainder ( numerator, denominator )

The abstract operation BigInt::remainder takes arguments numerator (a BigInt) and denominator (a BigInt) and returns either a normal completion containing a BigInt or a throw completion. It performs the following steps when called:

  1. denominator = 0이면, RangeError exception을 throw한다.
  2. numerator = 0이면, 0를 반환한다.
  3. quotient(numerator) / (denominator)로 둔다.
  4. truncatedQuotient(truncate(quotient))로 둔다.
  5. numerator - (denominator × truncatedQuotient)를 반환한다.
Note
결과의 sign은 dividend의 sign입니다.

6.1.6.2.7 BigInt::add ( x, y )

The abstract operation BigInt::add takes arguments x (a BigInt) and y (a BigInt) and returns a BigInt. It performs the following steps when called:

  1. x + y를 반환한다.

6.1.6.2.8 BigInt::subtract ( x, y )

The abstract operation BigInt::subtract takes arguments x (a BigInt) and y (a BigInt) and returns a BigInt. It performs the following steps when called:

  1. x - y를 반환한다.

6.1.6.2.9 BigInt::leftShift ( x, y )

The abstract operation BigInt::leftShift takes arguments x (a BigInt) and y (a BigInt) and returns a BigInt. It performs the following steps when called:

  1. y < 0이면, 다음을 수행한다.
    1. (floor((x) / 2-(y)))를 반환한다.
  2. x × 2y를 반환한다.
Note
여기서 semantics는 BigInt를 infinite length string of binary two's complement digit으로 취급하는 bitwise shift와 equivalent해야 합니다.

6.1.6.2.10 BigInt::signedRightShift ( x, y )

The abstract operation BigInt::signedRightShift takes arguments x (a BigInt) and y (a BigInt) and returns a BigInt. It performs the following steps when called:

  1. BigInt::leftShift(x, -y)를 반환한다.

6.1.6.2.11 BigInt::unsignedRightShift ( x, y )

The abstract operation BigInt::unsignedRightShift takes arguments x (a BigInt) and y (a BigInt) and returns a throw completion. It performs the following steps when called:

  1. TypeError exception을 throw한다.

6.1.6.2.12 BigInt::lessThan ( x, y )

The abstract operation BigInt::lessThan takes arguments x (a BigInt) and y (a BigInt) and returns a Boolean. It performs the following steps when called:

  1. (x) < (y)이면, true를 반환한다.
  2. false를 반환한다.

6.1.6.2.13 BigInt::equal ( x, y )

The abstract operation BigInt::equal takes arguments x (a BigInt) and y (a BigInt) and returns a Boolean. It performs the following steps when called:

  1. (x) = (y)이면, true를 반환한다.
  2. false를 반환한다.

6.1.6.2.14 BinaryAnd ( x, y )

The abstract operation BinaryAnd takes arguments x (0 or 1) and y (0 or 1) and returns 0 or 1. It performs the following steps when called:

  1. x = 1이고 y = 1이면, 1을 반환한다.
  2. 0을 반환한다.

6.1.6.2.15 BinaryOr ( x, y )

The abstract operation BinaryOr takes arguments x (0 or 1) and y (0 or 1) and returns 0 or 1. It performs the following steps when called:

  1. x = 1이거나 y = 1이면, 1을 반환한다.
  2. 0을 반환한다.

6.1.6.2.16 BinaryXor ( x, y )

The abstract operation BinaryXor takes arguments x (0 or 1) and y (0 or 1) and returns 0 or 1. It performs the following steps when called:

  1. x = 1이고 y = 0이면, 1을 반환한다.
  2. x = 0이고 y = 1이면, 1을 반환한다.
  3. 0을 반환한다.

6.1.6.2.17 BigIntBitwiseOp ( op, x, y )

The abstract operation BigIntBitwiseOp takes arguments op (&, ^, or |), x (a BigInt), and y (a BigInt) and returns a BigInt. It performs the following steps when called:

  1. x(x)로 설정한다.
  2. y(y)로 설정한다.
  3. result를 0으로 둔다.
  4. shift를 0으로 둔다.
  5. (x = 0 또는 x = -1)이고 (y = 0 또는 y = -1)이 될 때까지 Repeat한다.
    1. xDigitx modulo 2로 둔다.
    2. yDigity modulo 2로 둔다.
    3. op&이면, 다음을 수행한다.
      1. resultresult + 2shift × BinaryAnd(xDigit, yDigit)로 설정한다.
    4. 그렇지 않고 op|이면, 다음을 수행한다.
      1. resultresult + 2shift × BinaryOr(xDigit, yDigit)로 설정한다.
    5. 그렇지 않으면,
      1. Assert: op^이다.
      2. resultresult + 2shift × BinaryXor(xDigit, yDigit)로 설정한다.
    6. shiftshift + 1로 설정한다.
    7. x를 (x - xDigit) / 2로 설정한다.
    8. y를 (y - yDigit) / 2로 설정한다.
  6. op&이면, 다음을 수행한다.
    1. signBitBinaryAnd(x modulo 2, y modulo 2)로 둔다.
  7. 그렇지 않고 op|이면, 다음을 수행한다.
    1. signBitBinaryOr(x modulo 2, y modulo 2)로 둔다.
  8. 그렇지 않으면,
    1. Assert: op^이다.
    2. signBitBinaryXor(x modulo 2, y modulo 2)로 둔다.
  9. signBit ≠ 0이면, 다음을 수행한다.
    1. resultresult - 2shift로 설정한다.
    2. NOTE: 이는 sign을 extends한다.
  10. result에 대한 BigInt value를 반환한다.

6.1.6.2.18 BigInt::bitwiseAND ( x, y )

The abstract operation BigInt::bitwiseAND takes arguments x (a BigInt) and y (a BigInt) and returns a BigInt. It performs the following steps when called:

  1. BigIntBitwiseOp(&, x, y)를 반환한다.

6.1.6.2.19 BigInt::bitwiseXOR ( x, y )

The abstract operation BigInt::bitwiseXOR takes arguments x (a BigInt) and y (a BigInt) and returns a BigInt. It performs the following steps when called:

  1. BigIntBitwiseOp(^, x, y)를 반환한다.

6.1.6.2.20 BigInt::bitwiseOR ( x, y )

The abstract operation BigInt::bitwiseOR takes arguments x (a BigInt) and y (a BigInt) and returns a BigInt. It performs the following steps when called:

  1. BigIntBitwiseOp(|, x, y)를 반환한다.

6.1.6.2.21 BigInt::toString ( x, radix )

The abstract operation BigInt::toString takes arguments x (a BigInt) and radix (an integer in the inclusive interval from 2 to 36) and returns a String. radix를 radix로 하는 positional numeral system을 사용하여 x를 String으로 나타냅니다. radix r을 사용한 BigInt representation에서 사용되는 digit은 "0123456789abcdefghijklmnopqrstuvwxyz"의 처음 r code unit에서 순서대로 가져옵니다. 0 이외의 BigInt representation은 leading zero를 결코 포함하지 않습니다. It performs the following steps when called:

  1. x < 0이면, "-"BigInt::toString(-x, radix)의 string-concatenation을 반환한다.
  2. radix radix를 사용한 x의 representation으로 구성된 String value를 반환한다.

6.1.7 Object Type

Object type의 각 instance는 간단히 “an Object”라고도 하며, property의 collection을 나타냅니다. 각 property는 data property 또는 accessor property입니다:

  • data property는 key value를 ECMAScript language value 및 Boolean attribute의 set과 연관시킵니다.
  • accessor property는 key value를 하나 또는 두 개의 accessor function 및 Boolean attribute의 set과 연관시킵니다. accessor function은 property와 연관된 ECMAScript language value를 store하거나 retrieve하는 데 사용됩니다.

object의 property는 property key를 사용하여 unique하게 식별됩니다. property key는 String 또는 Symbol입니다. empty String을 포함한 모든 String과 Symbol은 property key로 valid합니다. property name은 String인 property key입니다.

integer indexCanonicalNumericIndexString(n)이 +0𝔽부터 𝔽(253 - 1)까지의 inclusive interval에 있는 integral Number를 반환하는 property name n입니다. array indexCanonicalNumericIndexString(n)이 +0𝔽부터 𝔽(232 - 2)까지의 inclusive interval에 있는 integral Number를 반환하는 integer index n입니다.

Note

모든 non-negative safe integer에는 대응하는 integer index가 있습니다. 232 - 1을 제외한 모든 32-bit unsigned integer에는 대응하는 array index가 있습니다. "-0"integer indexarray index도 아닙니다.

Property key는 property와 그 value에 access하는 데 사용됩니다. property에 대한 access에는 두 종류가 있습니다: 각각 value retrieval과 assignment에 대응하는 getset입니다. get 및 set access를 통해 accessible한 property에는 object의 직접적인 부분인 own properties와 property inheritance relationship을 통해 다른 associated object가 제공하는 inherited properties가 모두 포함됩니다. Inherited property는 associated object의 own 또는 inherited property일 수 있습니다. object의 각 own property는 그 object의 다른 own property의 key value와 distinct한 key value를 각각 가져야 합니다.

모든 object는 논리적으로 property의 collection이지만, property에 access하고 manipulate하는 semantics가 서로 다른 여러 form의 object가 있습니다. object의 여러 form에 대한 정의는 6.1.7.2를 참조하십시오.

또한 일부 object는 callable합니다. 이러한 object는 function 또는 function object라고 불리며 아래에서 더 자세히 설명됩니다. ECMAScript의 모든 function은 Object type의 member입니다.

6.1.7.1 Property Attributes

Attribute는 Table 3에 설명된 Object property의 state를 정의하고 설명하기 위해 이 명세에서 사용됩니다. 명시적으로 specified되지 않는 한, 각 attribute의 initial value는 그 Default Value입니다.

Table 3: Attributes of an Object property
Attribute Name 그것이 present하는 property의 type Value Domain Default Value Description
[[Value]] data property ECMAScript language value undefined property의 get access에 의해 retrieved되는 value입니다.
[[Writable]] data property Boolean false false이면, ECMAScript code가 [[Set]]을 사용하여 property의 [[Value]] attribute를 변경하려는 시도는 성공하지 않습니다.
[[Get]] accessor property Object 또는 undefined undefined value가 Object이면 function object여야 합니다. property의 get access가 수행될 때마다, property value를 retrieve하기 위해 function의 [[Call]] internal method(Table 5)가 empty arguments list와 함께 호출됩니다.
[[Set]] accessor property Object 또는 undefined undefined value가 Object이면 function object여야 합니다. property의 set access가 수행될 때마다, assigned value를 sole argument로 포함하는 arguments list와 함께 function의 [[Call]] internal method(Table 5)가 호출됩니다. property의 [[Set]] internal method의 effect는 subsequent call에서 property의 [[Get]] internal method가 반환하는 value에 effect를 가질 수 있지만, 반드시 그래야 하는 것은 아닙니다.
[[Enumerable]] data property 또는 accessor property Boolean false true이면, property는 for-in enumeration(14.7.5 참조)에 의해 enumerated됩니다. 그렇지 않으면 property는 non-enumerable이라고 합니다.
[[Configurable]] data property 또는 accessor property Boolean false false이면, property를 delete하거나, data property에서 accessor property로 또는 accessor property에서 data property로 변경하거나, 그 attribute에 변경을 가하려는 시도(기존 [[Value]]를 replacing하거나 [[Writable]]false로 setting하는 것 제외)는 fail합니다.

6.1.7.2 Object Internal Methods and Internal Slots

ECMAScript에서 object의 실제 semantics는 internal methods라고 불리는 algorithm을 통해 specified됩니다. ECMAScript engine의 각 object는 그 runtime behaviour를 정의하는 internal method의 set과 associated됩니다. 이러한 internal method는 ECMAScript language의 일부가 아닙니다. 이들은 순전히 expository purpose를 위해 이 명세에서 정의됩니다. 그러나 ECMAScript implementation 안의 각 object는 자신과 associated된 internal method에 의해 specified된 대로 behave해야 합니다. 이를 달성하는 정확한 방식은 implementation에 의해 결정됩니다.

Internal method name은 polymorphic입니다. 이는 common internal method name이 서로 다른 object value에서 invoked될 때 서로 다른 algorithm을 수행할 수 있음을 의미합니다. internal method가 invoked되는 실제 object는 invocation의 “target”입니다. runtime에 algorithm의 implementation이 object가 support하지 않는 internal method를 사용하려고 하면, TypeError exception이 thrown됩니다.

Internal slot은 object, Symbol 또는 Private Name과 associated되어 다양한 ECMAScript specification algorithm에서 사용되는 internal state에 대응합니다. Internal slot은 object property가 아니며 inherited되지 않습니다. 특정 internal slot specification에 따라, 이러한 state는 어떤 ECMAScript language type의 value나 특정 ECMAScript specification type value로 구성될 수 있습니다. 달리 explicitly specified되지 않는 한, internal slot은 object, Symbol 또는 Private Name을 생성하는 process의 일부로 allocated되며 dynamically added될 수 없습니다. 달리 specified되지 않는 한, internal slot의 initial value는 undefined 값입니다. 이 명세 안의 다양한 algorithm은 internal slot을 가진 value를 생성합니다. 그러나 ECMAScript language는 internal slot을 manipulate하는 직접적인 방법을 제공하지 않습니다.

모든 object는 [[PrivateElements]]라는 internal slot을 가지며, 이는 PrivateElementsList입니다. 이 List는 object에 대한 private field, method 및 accessor의 value를 나타냅니다. Initially, 이는 empty List입니다.

Internal method와 internal slot은 이 명세 안에서 double square bracket [[ ]]으로 둘러싸인 name을 사용하여 식별됩니다.

Table 4는 ECMAScript code에 의해 생성되거나 manipulated되는 모든 object에 applicable한 이 명세에서 사용되는 essential internal methods를 요약합니다. 모든 object는 모든 essential internal method에 대한 algorithm을 가져야 합니다. 그러나 모든 object가 그 method에 대해 반드시 같은 algorithm을 사용하는 것은 아닙니다.

ordinary object는 다음 criteria를 모두 만족하는 object입니다:

  • Table 4에 나열된 internal method에 대해, object는 10.1에 정의된 것들을 사용합니다.
  • object가 [[Call]] internal method를 가지는 경우, 10.2.1에 정의된 것 또는 10.3.1에 정의된 것 중 하나를 사용합니다.
  • object가 [[Construct]] internal method를 가지는 경우, 10.2.2에 정의된 것 또는 10.3.2에 정의된 것 중 하나를 사용합니다.

exotic objectordinary object가 아닌 object입니다.

이 명세는 object의 internal method에 의해 여러 종류의 exotic object를 인식합니다. 특정 종류의 exotic object(예: Array exotic object 또는 bound function exotic object)와 behaviourally equivalent하지만 그 종류에 대해 specified된 동일한 collection of internal method를 가지지 않는 object는 그 종류의 exotic object로 인식되지 않습니다.

Table 4 및 기타 유사한 table의 “Signature” column은 각 internal method의 invocation pattern을 설명합니다. invocation pattern은 항상 descriptive parameter name의 parenthesized list를 포함합니다. parameter name이 ECMAScript type name과 같으면 그 name은 parameter value의 required type을 설명합니다. internal method가 명시적으로 value를 반환하면, parameter list 뒤에 symbol “→”와 returned value의 type name이 옵니다. signature에서 사용되는 type name은 6 절에 정의된 type에 다음 additional name을 보강한 것을 가리킵니다. “any”는 value가 어떤 ECMAScript language type도 될 수 있음을 의미합니다.

parameter 외에도, internal method는 항상 method invocation의 target인 object에 access할 수 있습니다.

internal method는 Completion Record를 implicitly 반환합니다. 이는 invocation pattern에 표시된 return type의 value를 wrap하는 normal completion이거나 throw completion입니다.

Table 4: Essential Internal Methods
Internal Method Signature Description
[[GetPrototypeOf]] ( ) Object | Null 이 object에 대해 inherited property를 제공하는 object를 결정합니다. null value는 inherited property가 없음을 나타냅니다.
[[SetPrototypeOf]] (Object | Null) Boolean inherited property를 제공하는 다른 object와 이 object를 associate합니다. null을 passing하는 것은 inherited property가 없음을 나타냅니다. operation이 successfully completed되었음을 나타내는 true 또는 operation이 successful하지 않았음을 나타내는 false를 반환합니다.
[[IsExtensible]] ( ) Boolean 이 object에 additional property를 add하는 것이 permitted되는지 결정합니다.
[[PreventExtensions]] ( ) Boolean new property가 이 object에 added될 수 있는지 control합니다. operation이 successful이면 true를, unsuccessful이면 false를 반환합니다.
[[GetOwnProperty]] (propertyKey) Undefined | Property Descriptor key가 propertyKey인 이 object의 own property에 대한 Property Descriptor를 반환하거나, 그러한 property가 없으면 undefined를 반환합니다.
[[DefineOwnProperty]] (propertyKey, propertyDesc) Boolean key가 propertyKey인 own property가 propertyDesc가 설명하는 state를 가지도록 create하거나 alter합니다. 해당 property가 successfully created/updated되었으면 true를 반환하고, property를 create하거나 update할 수 없으면 false를 반환합니다.
[[HasProperty]] (propertyKey) Boolean 이 object가 이미 key가 propertyKey인 own 또는 inherited property를 가지고 있는지 나타내는 Boolean value를 반환합니다.
[[Get]] (propertyKey, receiver) any 이 object에서 key가 propertyKey인 property의 value를 반환합니다. property value를 retrieve하기 위해 ECMAScript code가 실행되어야 하는 경우, code를 evaluating할 때 receiverthis value로 사용됩니다.
[[Set]] (propertyKey, value, receiver) Boolean key가 propertyKey인 property의 value를 value로 set합니다. property value를 set하기 위해 ECMAScript code가 실행되어야 하는 경우, code를 evaluating할 때 receiverthis value로 사용됩니다. property value가 set되었으면 true를, set될 수 없으면 false를 반환합니다.
[[Delete]] (propertyKey) Boolean key가 propertyKey인 own property를 이 object에서 remove합니다. property가 deleted되지 않았고 여전히 present하면 false를 반환합니다. property가 deleted되었거나 present하지 않으면 true를 반환합니다.
[[OwnPropertyKeys]] ( ) List of property keys element가 object의 모든 own property keyList를 반환합니다.

Table 5는 function으로 called될 수 있는 object가 support하는 additional essential internal method를 요약합니다. function object[[Call]] internal method를 support하는 object입니다. constructor[[Construct]] internal method를 support하는 object입니다. [[Construct]]를 support하는 모든 object는 [[Call]]을 support해야 합니다. 즉, 모든 constructorfunction object여야 합니다. 따라서 constructorconstructor function 또는 constructor function object라고도 지칭될 수 있습니다.

Table 5: Additional Essential Internal Methods of Function Objects
Internal Method Signature Description
[[Call]] (any, a List of any) any 이 object와 associated된 code를 executes합니다. function call expression을 통해 invoked됩니다. internal method에 대한 argument는 this value와 call expression에 의해 function에 passed된 argument를 element로 하는 List입니다. 이 internal method를 implement하는 object는 callable입니다.
[[Construct]] (a List of any, Object) Object object를 creates합니다. new operator 또는 super call을 통해 invoked됩니다. internal method의 첫 번째 argument는 constructor invocation 또는 super call의 argument를 element로 하는 List입니다. 두 번째 argument는 new operator가 initially applied된 object입니다. 이 internal method를 implement하는 object는 constructors라고 불립니다. function object가 반드시 constructor인 것은 아니며, 그러한 non-constructor function object[[Construct]] internal method를 가지지 않습니다.

ordinary object 및 standard exotic object에 대한 essential internal method의 semantics는 10 절에 specified되어 있습니다. exotic object의 internal method의 specified된 사용이 implementation에서 support되지 않는 경우, 해당 usage를 시도할 때 TypeError exception을 throw해야 합니다.

6.1.7.3 Essential Internal Methods의 Invariants

ECMAScript engine의 Object의 Internal Method는 아래에 specified된 invariant list를 conform해야 합니다. Ordinary ECMAScript Object뿐 아니라 이 명세의 모든 standard exotic object도 이러한 invariant를 유지합니다. ECMAScript Proxy object는 [[ProxyHandler]] object에서 invoked된 trap의 result에 대한 runtime check를 통해 이러한 invariant를 유지합니다.

implementation provided exotic object도 해당 object에 대해 이러한 invariant를 유지해야 합니다. 이러한 invariant를 위반하면 ECMAScript code가 unpredictable behaviour를 보일 수 있고 security issue를 만들 수 있습니다. 그러나 이러한 invariant의 위반은 implementation의 memory safety를 결코 compromise해서는 안 됩니다.

implementation은 essential internal method의 functionality를 implement하면서 invariant를 enforce하지 않는 alternative interface를 제공하는 등의 어떠한 방식으로도 이러한 invariant가 circumvent되도록 허용해서는 안 됩니다.

Definitions:

  • internal method의 target은 internal method가 called되는 object입니다.
  • target은 자신의 [[IsExtensible]] internal method에서 false를 반환하거나, 자신의 [[PreventExtensions]] internal method에서 true를 반환하는 것이 observed되었으면 non-extensible입니다.
  • non-existent property는 non-extensible target에서 own property로 존재하지 않는 property입니다.
  • SameValue에 대한 모든 reference는 SameValue algorithm의 definition을 따릅니다.

Return value:

어떤 internal method가 반환하는 value도 다음 중 하나를 가지는 Completion Record여야 합니다:

  • [[Type]] = normal, [[Target]] = empty, 및 [[Value]] = 해당 internal method에 대해 아래에 표시된 “normal return type”의 value, 또는
  • [[Type]] = throw, [[Target]] = empty, 및 [[Value]] = 어떤 ECMAScript language value.
Note 1

internal method는 continue completion, break completion, 또는 return completion을 반환해서는 안 됩니다.

[[GetPrototypeOf]] ( )

  • normal return type은 Object 또는 Null입니다.
  • target이 non-extensible이고 [[GetPrototypeOf]]가 value proto를 반환하면, 이후 [[GetPrototypeOf]]에 대한 모든 call은 protoSameValue를 반환해야 합니다.
Note 2

object의 prototype chain은 finite length를 가져야 합니다(즉, 어떤 object에서 시작하여 [[GetPrototypeOf]] internal method를 그 result에 recursively applying하면 결국 null value에 도달해야 합니다). 그러나 prototype chain이 [[GetPrototypeOf]]ordinary object definition을 사용하지 않는 exotic object를 포함하는 경우, 이 requirement는 object level invariant로 enforce될 수 없습니다. 그러한 circular prototype chain은 object property에 access할 때 infinite loop를 초래할 수 있습니다.

[[SetPrototypeOf]] ( proto )

  • normal return type은 Boolean입니다.
  • target이 non-extensible이면, proto가 target의 observed [[GetPrototypeOf]] value와 SameValue가 아닌 한 [[SetPrototypeOf]]false를 반환해야 합니다.

[[IsExtensible]] ( )

  • normal return type은 Boolean입니다.
  • [[IsExtensible]]false를 반환하면, target에 대한 [[IsExtensible]]의 모든 future call은 false를 반환해야 합니다.

[[PreventExtensions]] ( )

  • normal return type은 Boolean입니다.
  • [[PreventExtensions]]true를 반환하면, target에 대한 [[IsExtensible]]의 모든 future call은 false를 반환해야 하며 target은 이제 non-extensible로 간주됩니다.

[[GetOwnProperty]] ( propertyKey )

  • normal return type은 Property Descriptor 또는 Undefined입니다.
  • return value가 Property Descriptor이면, 이는 fully populated Property Descriptor여야 합니다.
  • propertyKey가 non-configurable, non-writable own data property로 described되면, [[GetOwnProperty]] ( propertyKey )에 대한 모든 future call은 [[Value]]propertyKey[[Value]] attribute와 SameValueProperty Descriptor를 반환해야 합니다.
  • propertyKey[[Writable]][[Value]] 이외의 attribute가 시간이 지나면서 change될 수 있거나, property가 deleted될 수도 있으면, propertyKey[[Configurable]] attribute는 true여야 합니다.
  • [[Writable]] attribute가 false에서 true로 change될 수 있으면, [[Configurable]] attribute는 true여야 합니다.
  • target이 non-extensible이고 propertyKey가 non-existent이면, target에 대한 [[GetOwnProperty]] (propertyKey)의 모든 future call은 propertyKey를 non-existent로 describe해야 합니다(즉, [[GetOwnProperty]] (propertyKey)는 undefined를 반환해야 합니다).
Note 3

세 번째 invariant의 consequence로, property가 data property로 described되고 시간이 지나면서 다른 value를 반환할 수 있으면, 다른 essential internal method를 통해 value를 change하는 mechanism이 exposed되지 않더라도 [[Writable]][[Configurable]] attribute 중 하나 또는 둘 다 true여야 합니다.

[[DefineOwnProperty]] ( propertyKey, propertyDesc )

  • normal return type은 Boolean입니다.
  • propertyKey가 이전에 target의 non-configurable own property로 observed되었으면, 다음 중 하나가 아닌 한 [[DefineOwnProperty]]false를 반환해야 합니다:
    1. propertyKey가 writable data property인 경우. non-configurable writable data property는 non-configurable non-writable data property로 변경될 수 있습니다.
    2. propertyDesc의 모든 attribute가 propertyKey의 attribute와 SameValue인 경우.
  • target이 non-extensible이고 propertyKey가 non-existent own property이면, [[DefineOwnProperty]] (propertyKey, propertyDesc)는 false를 반환해야 합니다. 즉, non-extensible target object는 new property로 extended될 수 없습니다.

[[HasProperty]] ( propertyKey )

  • normal return type은 Boolean입니다.
  • propertyKey가 이전에 target의 non-configurable own data 또는 accessor property로 observed되었으면, [[HasProperty]]true를 반환해야 합니다.

[[Get]] ( propertyKey, receiver )

  • normal return type은 any ECMAScript language type입니다.
  • propertyKey가 이전에 target의 value value를 가진 non-configurable, non-writable own data property로 observed되었으면, [[Get]]valueSameValue를 반환해야 합니다.
  • propertyKey가 이전에 [[Get]] attribute가 undefined인 target의 non-configurable own accessor property로 observed되었으면, [[Get]] operation은 undefined를 반환해야 합니다.

[[Set]] ( propertyKey, value, receiver )

  • normal return type은 Boolean입니다.
  • propertyKey가 이전에 target의 non-configurable, non-writable own data property로 observed되었으면, valuepropertyKey[[Value]] attribute와 SameValue가 아닌 한 [[Set]]false를 반환해야 합니다.
  • propertyKey가 이전에 [[Set]] attribute가 undefined인 target의 non-configurable own accessor property로 observed되었으면, [[Set]] operation은 false를 반환해야 합니다.

[[Delete]] ( propertyKey )

  • normal return type은 Boolean입니다.
  • propertyKey가 이전에 target의 non-configurable own data 또는 accessor property로 observed되었으면, [[Delete]]false를 반환해야 합니다.

[[OwnPropertyKeys]] ( )

  • normal return type은 List입니다.
  • returned List는 duplicate entry를 포함해서는 안 됩니다.
  • returned List의 각 element는 property key여야 합니다.
  • returned List는 이전에 observed된 모든 non-configurable own property의 key를 적어도 포함해야 합니다.
  • target이 non-extensible이면, returned List[[GetOwnProperty]]를 사용하여 observable한 target의 모든 own property의 key만 포함해야 합니다.

[[Call]] ( )

[[Construct]] ( )

  • normal return type은 Object입니다.
  • target은 또한 [[Call]] internal method를 가져야 합니다.

6.1.7.4 Well-Known Intrinsic Objects

Well-known intrinsic은 이 명세의 algorithm에서 명시적으로 referenced되는 built-in object이며, 보통 realm-specific identity를 가집니다. 달리 specified되지 않는 한 각 intrinsic object는 실제로 realm마다 하나씩, 유사한 object의 set에 대응합니다.

이 명세 안에서 %name% 같은 reference는 current realm과 associated되고 해당 name에 대응하는 intrinsic object를 의미합니다. %name.a.b% 같은 reference는, ECMAScript code가 evaluated되기 전에 intrinsic object %name%의 "a" property value의 "b" property가 accessed된 것처럼 의미합니다. current realm과 그 intrinsic의 determination은 9.4에 설명되어 있습니다. well-known intrinsic은 Table 6에 listed되어 있습니다.

Table 6: 잘 알려진 내재 객체
내재 이름 전역 이름 ECMAScript 언어 연관
%AggregateError% "AggregateError" AggregateError 생성자 (20.5.7.1)
%Array% "Array" Array 생성자 (23.1.1)
%ArrayBuffer% "ArrayBuffer" ArrayBuffer 생성자 (25.1.4)
%ArrayIteratorPrototype% Array Iterator 객체의 프로토타입 (23.1.5)
%AsyncDisposableStack% "AsyncDisposableStack" AsyncDisposableStack 생성자 (27.4.1)
%AsyncFromSyncIteratorPrototype% Async-from-Sync Iterator 객체의 프로토타입 (27.1.5)
%AsyncFunction% async 함수 객체의 생성자 (27.10.1)
%AsyncGeneratorFunction% async generator 함수 객체의 생성자 (27.7.1)
%AsyncGeneratorPrototype% async generator 객체의 프로토타입 (27.9)
%AsyncIteratorPrototype% 모든 표준 내장 async iterator 객체가 간접적으로 상속하는 객체
%Atomics% "Atomics" Atomics 객체 (25.4)
%BigInt% "BigInt" BigInt 생성자 (21.2.1)
%BigInt64Array% "BigInt64Array" BigInt64Array 생성자 (23.2)
%BigUint64Array% "BigUint64Array" BigUint64Array 생성자 (23.2)
%Boolean% "Boolean" Boolean 생성자 (20.3.1)
%DataView% "DataView" DataView 생성자 (25.3.2)
%Date% "Date" Date 생성자 (21.4.2)
%decodeURI% "decodeURI" decodeURI 함수 (19.2.6.1)
%decodeURIComponent% "decodeURIComponent" decodeURIComponent 함수 (19.2.6.2)
%DisposableStack% "DisposableStack" DisposableStack 생성자 (27.3.1)
%encodeURI% "encodeURI" encodeURI 함수 (19.2.6.3)
%encodeURIComponent% "encodeURIComponent" encodeURIComponent 함수 (19.2.6.4)
%Error% "Error" Error 생성자 (20.5.1)
%eval% "eval" eval 함수 (19.2.1)
%EvalError% "EvalError" EvalError 생성자 (20.5.5.1)
%FinalizationRegistry% "FinalizationRegistry" FinalizationRegistry 생성자 (26.2.1)
%Float16Array% "Float16Array" Float16Array 생성자 (23.2)
%Float32Array% "Float32Array" Float32Array 생성자 (23.2)
%Float64Array% "Float64Array" Float64Array 생성자 (23.2)
%ForInIteratorPrototype% For-In Iterator 객체의 프로토타입 (14.7.5.10)
%Function% "Function" Function 생성자 (20.2.1)
%GeneratorFunction% generator 함수 객체의 생성자 (27.6.1)
%GeneratorPrototype% generator 객체의 프로토타입 (27.8)
%Int8Array% "Int8Array" Int8Array 생성자 (23.2)
%Int16Array% "Int16Array" Int16Array 생성자 (23.2)
%Int32Array% "Int32Array" Int32Array 생성자 (23.2)
%isFinite% "isFinite" isFinite 함수 (19.2.2)
%isNaN% "isNaN" isNaN 함수 (19.2.3)
%Iterator% "Iterator" Iterator 생성자 (27.1.3.1)
%IteratorHelperPrototype% Iterator Helper 객체의 프로토타입 (27.1.2.1)
%JSON% "JSON" JSON 객체 (25.5)
%Map% "Map" Map 생성자 (24.1.1)
%MapIteratorPrototype% Map Iterator 객체의 프로토타입 (24.1.5)
%Math% "Math" Math 객체 (21.3)
%Number% "Number" Number 생성자 (21.1.1)
%Object% "Object" Object 생성자 (20.1.1)
%parseFloat% "parseFloat" parseFloat 함수 (19.2.4)
%parseInt% "parseInt" parseInt 함수 (19.2.5)
%Promise% "Promise" Promise 생성자 (27.5.3)
%Proxy% "Proxy" Proxy 생성자 (28.2.1)
%RangeError% "RangeError" RangeError 생성자 (20.5.5.2)
%ReferenceError% "ReferenceError" ReferenceError 생성자 (20.5.5.3)
%Reflect% "Reflect" Reflect 객체 (28.1)
%RegExp% "RegExp" RegExp 생성자 (22.2.4)
%RegExpStringIteratorPrototype% RegExp String Iterator 객체의 프로토타입 (22.2.9)
%Set% "Set" Set 생성자 (24.2.2)
%SetIteratorPrototype% Set Iterator 객체의 프로토타입 (24.2.6)
%SharedArrayBuffer% "SharedArrayBuffer" SharedArrayBuffer 생성자 (25.2.3)
%String% "String" String 생성자 (22.1.1)
%StringIteratorPrototype% String Iterator 객체의 프로토타입 (22.1.5)
%SuppressedError% "SuppressedError" SuppressedError 생성자 (20.5.8.1)
%Symbol% "Symbol" Symbol 생성자 (20.4.1)
%SyntaxError% "SyntaxError" SyntaxError 생성자 (20.5.5.4)
%ThrowTypeError% 무조건 %TypeError%의 새 인스턴스를 던지는 함수 객체
%TypedArray% 모든 typed Array 생성자의 슈퍼클래스 (23.2.1)
%TypeError% "TypeError" TypeError 생성자 (20.5.5.5)
%Uint8Array% "Uint8Array" Uint8Array 생성자 (23.2)
%Uint8ClampedArray% "Uint8ClampedArray" Uint8ClampedArray 생성자 (23.2)
%Uint16Array% "Uint16Array" Uint16Array 생성자 (23.2)
%Uint32Array% "Uint32Array" Uint32Array 생성자 (23.2)
%URIError% "URIError" URIError 생성자 (20.5.5.6)
%WeakMap% "WeakMap" WeakMap 생성자 (24.3.1)
%WeakRef% "WeakRef" WeakRef 생성자 (26.1.1)
%WeakSet% "WeakSet" WeakSet 생성자 (24.4.1)
%WrapForValidIteratorPrototype% Iterator.from이 반환하는 감싸진 iterator 객체의 프로토타입 (27.1.3.2.2.1)
Note

Table 103에 additional entry가 있습니다.

6.2 ECMAScript Specification Types

specification type은 ECMAScript language construct와 ECMAScript language type의 semantics를 설명하기 위해 algorithm 안에서 사용되는 meta-value에 대응합니다. specification type에는 Reference Record, List, Completion Record, Property Descriptor, Environment Record, Abstract Closure, Data Block이 포함됩니다. Specification type value는 ECMAScript implementation 안의 특정 entity와 반드시 대응하지는 않는 specification artefact입니다. Specification type value는 ECMAScript expression evaluation의 intermediate result를 설명하는 데 사용될 수 있지만, 그러한 value는 object의 property나 ECMAScript language variable의 value로 저장될 수 없습니다.

6.2.1 Enum Specification Type

Enum은 specification 내부의 value이며 ECMAScript code에서 직접 observable하지 않습니다. Enum은 sans-serif typeface를 사용하여 upper kebab case로 표시됩니다. 예를 들어 Completion Record[[Type]] field는 normal, return, throw와 같은 value를 취합니다. Enum은 name 외의 characteristic을 가지지 않습니다. enum의 name은 다른 enum과 구별하는 것 외의 목적을 가지지 않으며, context에서의 usage나 meaning에 대해 아무것도 imply하지 않습니다.

6.2.2 List and Record Specification Types

List type은 new expression, function call, 그리고 simple ordered list of values가 필요한 다른 algorithm에서 argument list(13.3.8 참조)의 evaluation을 설명하는 데 사용됩니다. List type의 value는 individual value를 포함하는 list element의 ordered sequence일 뿐입니다. 이러한 sequence는 어떤 length도 될 수 있습니다. list의 element는 0-origin index를 사용하여 randomly accessed될 수 있습니다. notation 편의를 위해 array-like syntax를 사용하여 List element에 access할 수 있습니다. 예를 들어 args[2]는 List args의 3rd element를 말하는 shorthand입니다.

algorithm이 order를 지정하지 않고 List의 element를 iterate하면, 사용되는 order는 List 안의 element order입니다.

이 명세 안에서 notation 편의를 위해 literal syntax를 사용하여 새 List value를 표현할 수 있습니다. 예를 들어 « 1, 2 »는 각각 특정 value로 initialized된 두 element를 가진 List value를 정의합니다. 새 empty List는 « »로 표현할 수 있습니다.

이 명세에서 “A, B, ...의 list-concatenation”이라는 phrase(각 argument가 possibly empty List인 경우)는 각 argument의 element를 (순서대로) concatenation한 element를 가진 새 List value를 나타냅니다.

List of Strings에 적용될 때, “lexicographic code unit order에 따라 sorted”라는 phrase는 더 짧은 string의 length까지 각 code unit의 numeric value로 sorting하고, 모두 같으면 더 짧은 string을 더 긴 string보다 앞에 sorting함을 의미하며, 이는 abstract operation IsLessThan에 설명되어 있습니다.

Record type은 이 명세의 algorithm 안에서 data aggregation을 설명하는 데 사용됩니다. Record type value는 하나 이상의 named field로 구성됩니다. 각 field의 value는 ECMAScript language value 또는 specification value입니다. field name은 항상 double bracket으로 둘러싸입니다. 예: [[Value]].

이 명세 안에서 notation 편의를 위해 object literal-like syntax를 사용하여 Record value를 표현할 수 있습니다. 예를 들어 { [[Field1]]: 42, [[Field2]]: false, [[Field3]]: empty }는 세 field를 가지며 각각 특정 value로 initialized된 Record value를 정의합니다. Field name order는 중요하지 않습니다. 명시적으로 listed되지 않은 field는 absent인 것으로 간주됩니다.

specification text와 algorithm에서 dot notation은 Record value의 특정 field를 refer하는 데 사용될 수 있습니다. 예를 들어 R이 이전 paragraph에 표시된 record이면 R.[[Field2]]는 “[[Field2]]라는 name을 가진 R의 field”에 대한 shorthand입니다.

일반적으로 사용되는 Record field combination에 대한 schema에는 name이 붙을 수 있으며, 그 name은 literal Record value의 prefix로 사용되어 설명되는 aggregation의 특정 kind를 identify할 수 있습니다. 예: PropertyDescriptor { [[Value]]: 42, [[Writable]]: false, [[Configurable]]: true }.

6.2.3 Set and Relation Specification Types

Set type은 memory model에서 사용하기 위한 unordered element의 collection을 설명하는 데 사용됩니다. 이는 같은 name의 ECMAScript collection type과 distinct합니다. 구별을 위해, 이 명세 안에서 ECMAScript collection의 instance는 일관되게 “Set objects”라고 지칭됩니다. Set type의 value는 simple collection of elements이며, 어떤 element도 한 번보다 많이 나타나지 않습니다. element는 Set에 added되거나 removed될 수 있습니다. Set은 서로 unioned, intersected, subtracted될 수 있습니다.

Relation type은 Set에 대한 constraint를 설명하는 데 사용됩니다. Relation type의 value는 그 value domain에서 온 ordered pair of values의 Set입니다. 예를 들어 Memory event에 대한 Relation은 Memory event의 ordered pair의 set입니다. Relation RR의 value domain 안의 두 value ab에 대해, a R b는 ordered pair (a, b)가 R의 member임을 말하는 shorthand입니다. 어떤 condition에 관해 least Relation인 Relation은 그 condition을 만족하는 가장 작은 Relation입니다.

strict partial order는 다음을 만족하는 Relation value R입니다.

  • R의 domain 안의 모든 a, b, c에 대해:

    • a R a인 경우는 없고,
    • a R b이고 b R c이면, a R c입니다.
Note 1

위의 두 property는 각각 irreflexivity와 transitivity라고 불립니다.

strict total order는 다음을 만족하는 Relation value R입니다.

  • R의 domain 안의 모든 a, b, c에 대해:

    • ab이거나 a R b이거나 b R a이고,
    • a R a인 경우는 없고,
    • a R b이고 b R c이면, a R c입니다.
Note 2

위의 세 property는 각각 totality, irreflexivity, transitivity라고 불립니다.

6.2.4 Completion Record Specification Type

Completion Record specification type은 nonlocal transfer of control을 수행하는 statement(break, continue, return, throw)의 behaviour와 같은 value 및 control flow의 runtime propagation을 설명하는 데 사용됩니다.

Completion Record는 Table 7에 정의된 field를 가집니다.

Table 7: Completion Record Fields
Field Name Value Meaning
[[Type]] normal, break, continue, return, or throw 발생한 completion의 type입니다.
[[Value]] Completion Record를 제외한 모든 value 생성된 value입니다.
[[Target]] String 또는 empty directed control transfer를 위한 target label입니다.

다음 shorthand term은 때때로 Completion Record를 refer하는 데 사용됩니다.

  • normal completion[[Type]] value가 normal인 모든 Completion Record를 가리킵니다.
  • break completion[[Type]] value가 break인 모든 Completion Record를 가리킵니다.
  • continue completion[[Type]] value가 continue인 모든 Completion Record를 가리킵니다.
  • return completion[[Type]] value가 return인 모든 Completion Record를 가리킵니다.
  • throw completion[[Type]] value가 throw인 모든 Completion Record를 가리킵니다.
  • abrupt completion[[Type]] value가 normal이 아닌 모든 Completion Record를 가리킵니다.
  • 어떤 type의 value를 normal completion containing한다는 것은 [[Value]] field에 그 type의 value를 가진 normal completion을 가리킵니다.

이 명세에서 정의된 callable object는 normal completion 또는 throw completion만 반환합니다. 다른 종류의 Completion Record를 반환하는 것은 editorial error로 간주됩니다.

Implementation-defined callable object는 normal completion 또는 throw completion 중 하나를 반환해야 합니다.

6.2.4.1 NormalCompletion ( value )

The abstract operation NormalCompletion takes argument value (any value except a Completion Record) and returns a normal completion. It performs the following steps when called:

  1. Completion Record { [[Type]]: normal, [[Value]]: value, [[Target]]: empty }를 반환한다.

6.2.4.2 ThrowCompletion ( value )

The abstract operation ThrowCompletion takes argument value (an ECMAScript language value) and returns a throw completion. It performs the following steps when called:

  1. Completion Record { [[Type]]: throw, [[Value]]: value, [[Target]]: empty }를 반환한다.

6.2.4.3 ReturnCompletion ( value )

The abstract operation ReturnCompletion takes argument value (an ECMAScript language value) and returns a return completion. It performs the following steps when called:

  1. Completion Record { [[Type]]: return, [[Value]]: value, [[Target]]: empty }를 반환한다.

6.2.4.4 UpdateEmpty ( completionRecord, value )

The abstract operation UpdateEmpty takes arguments completionRecord (a Completion Record) and value (any value except a Completion Record) and returns a Completion Record. It performs the following steps when called:

  1. Assert: completionRecordreturn completion 또는 throw completion이면, completionRecord.[[Value]]empty가 아니다.
  2. completionRecord.[[Value]]empty가 아니면, ? completionRecord를 반환한다.
  3. Completion Record { [[Type]]: completionRecord.[[Type]], [[Value]]: value, [[Target]]: completionRecord.[[Target]] }를 반환한다.

6.2.5 Reference Record Specification Type

Reference Record type은 delete, typeof, assignment operator, super keyword 및 기타 language feature와 같은 operator의 behaviour를 설명하는 데 사용됩니다. 예를 들어 assignment의 left-hand operand는 Reference Record를 생성할 것으로 expected됩니다.

Reference Record는 resolved name 또는 (possibly not-yet-resolved) property binding입니다. 그 field는 Table 8에 의해 정의됩니다.

Table 8: Reference Record Fields
Field Name Value Meaning
[[Base]] ECMAScript language value, Environment Record, 또는 unresolvable binding을 hold하는 value 또는 Environment Record입니다. unresolvable[[Base]]는 binding이 resolve될 수 없었음을 나타냅니다.
[[ReferencedName]] ECMAScript language value 또는 Private Name binding의 name입니다. [[Base]] value가 Environment Record이면 항상 String입니다. 그렇지 않으면 ToPropertyKey가 수행될 때까지 String이나 Symbol이 아닌 ECMAScript language value일 수 있습니다.
[[Strict]] Boolean Reference Recordstrict mode code에서 originated되었으면 true, 그렇지 않으면 false입니다.
[[ThisValue]] ECMAScript language value 또는 empty empty가 아니면, Reference Recordsuper keyword를 사용하여 표현된 property binding을 나타냅니다. 이는 Super Reference Record라고 불리며, 그 [[Base]] value는 결코 Environment Record가 아닙니다. 이 경우 [[ThisValue]] field는 Reference Record가 생성된 시점의 this value를 hold합니다.

다음 abstract operation은 Reference Record를 대상으로 operate하기 위해 이 명세에서 사용됩니다:

6.2.5.1 IsPropertyReference ( refRecord )

The abstract operation IsPropertyReference takes argument refRecord (a Reference Record) and returns a Boolean. It performs the following steps when called:

  1. refRecord.[[Base]]unresolvable이면, false를 반환한다.
  2. refRecord.[[Base]]Environment Record이면, false를 반환한다.
  3. true를 반환한다.

6.2.5.2 IsUnresolvableReference ( refRecord )

The abstract operation IsUnresolvableReference takes argument refRecord (a Reference Record) and returns a Boolean. It performs the following steps when called:

  1. refRecord.[[Base]]unresolvable이면, true를 반환한다.
  2. false를 반환한다.

6.2.5.3 IsSuperReference ( refRecord )

The abstract operation IsSuperReference takes argument refRecord (a Reference Record) and returns a Boolean. It performs the following steps when called:

  1. refRecord.[[ThisValue]]empty이면, false를 반환한다.
  2. true를 반환한다.

6.2.5.4 IsPrivateReference ( refRecord )

The abstract operation IsPrivateReference takes argument refRecord (a Reference Record) and returns a Boolean. It performs the following steps when called:

  1. refRecord.[[ReferencedName]]Private Name이면, true를 반환한다.
  2. false를 반환한다.

6.2.5.5 GetValue ( refRecord )

The abstract operation GetValue takes argument refRecord (a Reference Record or an ECMAScript language value) and returns either a normal completion containing an ECMAScript language value or an abrupt completion. It performs the following steps when called:

  1. refRecordReference Record가 아니면, refRecord를 반환한다.
  2. IsUnresolvableReference(refRecord)가 true이면, ReferenceError exception을 throw한다.
  3. IsPropertyReference(refRecord)가 true이면, 다음을 수행한다.
    1. baseObj를 ? ToObject(refRecord.[[Base]])로 둔다.
    2. IsPrivateReference(refRecord)가 true이면, 다음을 수행한다.
      1. PrivateGet(baseObj, refRecord.[[ReferencedName]])을 반환한다.
    3. refRecord.[[ReferencedName]]property key가 아니면, 다음을 수행한다.
      1. refRecord.[[ReferencedName]]을 ? ToPropertyKey(refRecord.[[ReferencedName]])로 설정한다.
    4. baseObj.[[Get]](refRecord.[[ReferencedName]], GetThisValue(refRecord))를 반환한다.
  4. baserefRecord.[[Base]]로 둔다.
  5. Assert: baseEnvironment Record이다.
  6. base.GetBindingValue(refRecord.[[ReferencedName]], refRecord.[[Strict]])를 반환한다(9.1 참조).
Note

step 3.a에서 생성될 수 있는 object는 위 abstract operation 및 ordinary object [[Get]] internal method 밖에서 accessible하지 않습니다. implementation은 object의 실제 생성을 피하도록 선택할 수도 있습니다.

6.2.5.6 PutValue ( refRecord, value )

The abstract operation PutValue takes arguments refRecord (a Reference Record or an ECMAScript language value) and value (an ECMAScript language value) and returns either a normal completion containing unused or an abrupt completion. It performs the following steps when called:

  1. refRecordReference Record가 아니면, ReferenceError exception을 throw한다.
  2. IsUnresolvableReference(refRecord)가 true이면, 다음을 수행한다.
    1. refRecord.[[Strict]]true이면, ReferenceError exception을 throw한다.
    2. globalObjGetGlobalObject()로 둔다.
    3. Set(globalObj, refRecord.[[ReferencedName]], value, false)를 수행한다.
    4. unused를 반환한다.
  3. IsPropertyReference(refRecord)가 true이면, 다음을 수행한다.
    1. baseObj를 ? ToObject(refRecord.[[Base]])로 둔다.
    2. IsPrivateReference(refRecord)가 true이면, 다음을 수행한다.
      1. PrivateSet(baseObj, refRecord.[[ReferencedName]], value)를 반환한다.
    3. refRecord.[[ReferencedName]]property key가 아니면, 다음을 수행한다.
      1. refRecord.[[ReferencedName]]을 ? ToPropertyKey(refRecord.[[ReferencedName]])로 설정한다.
    4. succeeded를 ? baseObj.[[Set]](refRecord.[[ReferencedName]], value, GetThisValue(refRecord))로 둔다.
    5. succeededfalse이고 refRecord.[[Strict]]true이면, TypeError exception을 throw한다.
    6. unused를 반환한다.
  4. baserefRecord.[[Base]]로 둔다.
  5. Assert: baseEnvironment Record이다.
  6. base.SetMutableBinding(refRecord.[[ReferencedName]], value, refRecord.[[Strict]])를 반환한다(9.1 참조).
Note

step 3.a에서 생성될 수 있는 object는 위 abstract operation 및 ordinary object [[Set]] internal method 밖에서 accessible하지 않습니다. implementation은 해당 object의 실제 생성을 피하도록 선택할 수도 있습니다.

6.2.5.7 GetThisValue ( refRecord )

The abstract operation GetThisValue takes argument refRecord (a Reference Record) and returns an ECMAScript language value. It performs the following steps when called:

  1. Assert: IsPropertyReference(refRecord)는 true이다.
  2. IsSuperReference(refRecord)가 true이면, refRecord.[[ThisValue]]를 반환한다.
  3. refRecord.[[Base]]를 반환한다.

6.2.5.8 InitializeReferencedBinding ( refRecord, value )

The abstract operation InitializeReferencedBinding takes arguments refRecord (a Reference Record) and value (an ECMAScript language value) and returns either a normal completion containing unused or an abrupt completion. It performs the following steps when called:

  1. Assert: IsUnresolvableReference(refRecord)는 false이다.
  2. baserefRecord.[[Base]]로 둔다.
  3. Assert: baseEnvironment Record이다.
  4. base.InitializeBinding(refRecord.[[ReferencedName]], value)를 반환한다.

6.2.5.9 MakePrivateReference ( baseValue, privateIdentifier )

The abstract operation MakePrivateReference takes arguments baseValue (an ECMAScript language value) and privateIdentifier (a String) and returns a Reference Record. It performs the following steps when called:

  1. privateEnvrunning execution context의 PrivateEnvironment로 둔다.
  2. Assert: privateEnvnull이 아니다.
  3. privateNameResolvePrivateIdentifier(privateEnv, privateIdentifier)로 둔다.
  4. Reference Record { [[Base]]: baseValue, [[ReferencedName]]: privateName, [[Strict]]: true, [[ThisValue]]: empty }를 반환한다.

6.2.6 Property Descriptor Specification Type

Property Descriptor type은 Object property attribute의 manipulation과 reification을 설명하는 데 사용됩니다. Property Descriptor는 zero or more field를 가진 Record이며, 각 field의 name은 attribute name이고 그 value는 6.1.7.1에 specified된 대응하는 attribute value입니다. Property Descriptor record의 literal description에 tag를 붙이기 위해 이 명세 안에서 사용되는 schema name은 “PropertyDescriptor”입니다.

Property Descriptor value는 특정 field의 existence 또는 use에 따라 data Property Descriptor와 accessor Property Descriptor로 further classified될 수 있습니다. data Property Descriptor는 [[Value]] 또는 [[Writable]]이라는 이름의 field 중 하나를 포함하는 것입니다. accessor Property Descriptor는 [[Get]] 또는 [[Set]]이라는 이름의 field 중 하나를 포함하는 것입니다. 어떤 Property Descriptor든 [[Enumerable]][[Configurable]]이라는 이름의 field를 가질 수 있습니다. Property Descriptor value는 data Property Descriptor이면서 동시에 accessor Property Descriptor일 수 없습니다. 그러나 둘 다 아닐 수는 있습니다(이 경우 generic Property Descriptor입니다). fully populated Property Descriptor는 accessor Property Descriptor 또는 data Property Descriptor이며, Table 3에 정의된 대응하는 field를 모두 가진 것입니다.

다음 abstract operation은 Property Descriptor value를 대상으로 operate하기 위해 이 명세에서 사용됩니다:

6.2.6.1 IsAccessorDescriptor ( propertyDesc )

The abstract operation IsAccessorDescriptor takes argument propertyDesc (a Property Descriptor) and returns a Boolean. It performs the following steps when called:

  1. propertyDesc[[Get]] field를 가지면, true를 반환한다.
  2. propertyDesc[[Set]] field를 가지면, true를 반환한다.
  3. false를 반환한다.

6.2.6.2 IsDataDescriptor ( propertyDesc )

The abstract operation IsDataDescriptor takes argument propertyDesc (a Property Descriptor) and returns a Boolean. It performs the following steps when called:

  1. propertyDesc[[Value]] field를 가지면, true를 반환한다.
  2. propertyDesc[[Writable]] field를 가지면, true를 반환한다.
  3. false를 반환한다.

6.2.6.3 IsGenericDescriptor ( propertyDesc )

The abstract operation IsGenericDescriptor takes argument propertyDesc (a Property Descriptor) and returns a Boolean. It performs the following steps when called:

  1. IsAccessorDescriptor(propertyDesc)가 true이면, false를 반환한다.
  2. IsDataDescriptor(propertyDesc)가 true이면, false를 반환한다.
  3. true를 반환한다.

6.2.6.4 FromPropertyDescriptor ( propertyDesc )

The abstract operation FromPropertyDescriptor takes argument propertyDesc (a Property Descriptor or undefined) and returns an Object or undefined. It performs the following steps when called:

  1. propertyDescundefined이면, undefined를 반환한다.
  2. objOrdinaryObjectCreate(%Object.prototype%)로 둔다.
  3. Assert: obj는 own property가 없는 extensible ordinary object이다.
  4. propertyDesc[[Value]] field를 가지면, 다음을 수행한다.
    1. CreateDataPropertyOrThrow(obj, "value", propertyDesc.[[Value]])를 수행한다.
  5. propertyDesc[[Writable]] field를 가지면, 다음을 수행한다.
    1. CreateDataPropertyOrThrow(obj, "writable", propertyDesc.[[Writable]])를 수행한다.
  6. propertyDesc[[Get]] field를 가지면, 다음을 수행한다.
    1. CreateDataPropertyOrThrow(obj, "get", propertyDesc.[[Get]])를 수행한다.
  7. propertyDesc[[Set]] field를 가지면, 다음을 수행한다.
    1. CreateDataPropertyOrThrow(obj, "set", propertyDesc.[[Set]])를 수행한다.
  8. propertyDesc[[Enumerable]] field를 가지면, 다음을 수행한다.
    1. CreateDataPropertyOrThrow(obj, "enumerable", propertyDesc.[[Enumerable]])를 수행한다.
  9. propertyDesc[[Configurable]] field를 가지면, 다음을 수행한다.
    1. CreateDataPropertyOrThrow(obj, "configurable", propertyDesc.[[Configurable]])를 수행한다.
  10. obj를 반환한다.

6.2.6.5 ToPropertyDescriptor ( obj )

The abstract operation ToPropertyDescriptor takes argument obj (an ECMAScript language value) and returns either a normal completion containing a Property Descriptor or a throw completion. It performs the following steps when called:

  1. obj가 Object가 아니면, TypeError exception을 throw한다.
  2. propertyDesc를 initially field가 없는 새 Property Descriptor로 둔다.
  3. hasEnumerable을 ? HasProperty(obj, "enumerable")로 둔다.
  4. hasEnumerabletrue이면, 다음을 수행한다.
    1. enumerableToBoolean(? Get(obj, "enumerable"))으로 둔다.
    2. propertyDesc.[[Enumerable]]enumerable로 설정한다.
  5. hasConfigurable을 ? HasProperty(obj, "configurable")로 둔다.
  6. hasConfigurabletrue이면, 다음을 수행한다.
    1. configurableToBoolean(? Get(obj, "configurable"))으로 둔다.
    2. propertyDesc.[[Configurable]]configurable로 설정한다.
  7. hasValue를 ? HasProperty(obj, "value")로 둔다.
  8. hasValuetrue이면, 다음을 수행한다.
    1. value를 ? Get(obj, "value")로 둔다.
    2. propertyDesc.[[Value]]value로 설정한다.
  9. hasWritable을 ? HasProperty(obj, "writable")로 둔다.
  10. hasWritabletrue이면, 다음을 수행한다.
    1. writableToBoolean(? Get(obj, "writable"))으로 둔다.
    2. propertyDesc.[[Writable]]writable로 설정한다.
  11. hasGet을 ? HasProperty(obj, "get")로 둔다.
  12. hasGettrue이면, 다음을 수행한다.
    1. getter를 ? Get(obj, "get")로 둔다.
    2. IsCallable(getter)가 false이고 getterundefined가 아니면, TypeError exception을 throw한다.
    3. propertyDesc.[[Get]]getter로 설정한다.
  13. hasSet을 ? HasProperty(obj, "set")로 둔다.
  14. hasSettrue이면, 다음을 수행한다.
    1. setter를 ? Get(obj, "set")로 둔다.
    2. IsCallable(setter)가 false이고 setterundefined가 아니면, TypeError exception을 throw한다.
    3. propertyDesc.[[Set]]setter로 설정한다.
  15. propertyDesc[[Get]] field를 가지거나 propertyDesc[[Set]] field를 가지면, 다음을 수행한다.
    1. propertyDesc[[Value]] field를 가지거나 propertyDesc[[Writable]] field를 가지면, TypeError exception을 throw한다.
  16. propertyDesc를 반환한다.

6.2.6.6 CompletePropertyDescriptor ( propertyDesc )

The abstract operation CompletePropertyDescriptor takes argument propertyDesc (a Property Descriptor) and returns unused. It performs the following steps when called:

  1. likeRecord { [[Value]]: undefined, [[Writable]]: false, [[Get]]: undefined, [[Set]]: undefined, [[Enumerable]]: false, [[Configurable]]: false }로 둔다.
  2. IsGenericDescriptor(propertyDesc)가 true이거나 IsDataDescriptor(propertyDesc)가 true이면, 다음을 수행한다.
    1. propertyDesc[[Value]] field를 가지지 않으면, propertyDesc.[[Value]]like.[[Value]]로 설정한다.
    2. propertyDesc[[Writable]] field를 가지지 않으면, propertyDesc.[[Writable]]like.[[Writable]]로 설정한다.
  3. 그렇지 않으면,
    1. propertyDesc[[Get]] field를 가지지 않으면, propertyDesc.[[Get]]like.[[Get]]로 설정한다.
    2. propertyDesc[[Set]] field를 가지지 않으면, propertyDesc.[[Set]]like.[[Set]]로 설정한다.
  4. propertyDesc[[Enumerable]] field를 가지지 않으면, propertyDesc.[[Enumerable]]like.[[Enumerable]]로 설정한다.
  5. propertyDesc[[Configurable]] field를 가지지 않으면, propertyDesc.[[Configurable]]like.[[Configurable]]로 설정한다.
  6. unused를 반환한다.

6.2.7 Environment Record Specification Type

Environment Record type은 nested function 및 block에서 name resolution의 behaviour를 설명하는 데 사용됩니다. 이 type과 그 operation은 9.1에 정의되어 있습니다.

6.2.8 Abstract Closure Specification Type

Abstract Closure specification type은 algorithm step과 value collection을 함께 refer하는 데 사용됩니다. Abstract Closure는 meta-value이며 closure(arg1, arg2)와 같은 function application style을 사용하여 invoked됩니다. abstract operation처럼 invocation은 Abstract Closure가 설명하는 algorithm step을 수행합니다.

Abstract Closure를 생성하는 algorithm step에서 value는 “capture”라는 verb 뒤에 alias list를 사용하여 captured됩니다. Abstract Closure가 생성되면, 그 시점에 각 alias와 associated된 value를 capture합니다. Abstract Closure가 called될 때 수행될 algorithm을 specify하는 step에서 각 captured value는 value를 capture하는 데 사용된 alias로 referred됩니다.

Abstract Closure가 Completion Record를 반환하면, 그 Completion Recordnormal completion 또는 throw completion이어야 합니다.

Abstract Closure는 다른 algorithm의 일부로 inline 생성되며, 다음 example에 표시되어 있습니다.

  1. addend를 41로 둔다.
  2. closure를 parameter (x)를 가지고 addend를 capture하며 called될 때 다음 step을 수행하는 새 Abstract Closure로 둔다:
    1. x + addend를 반환한다.
  3. valueclosure(1)로 둔다.
  4. Assert: value는 42이다.

6.2.9 Data Blocks

Data Block specification type은 byte-sized(8 bit) numeric value의 distinct하고 mutable한 sequence를 설명하는 데 사용됩니다. byte value는 0부터 255까지의 inclusive interval에 있는 integer입니다. Data Block value는 fixed number of byte로 생성되며, 각 byte의 initial value는 0입니다.

이 명세 안에서 notation 편의를 위해 array-like syntax를 사용하여 Data Block value의 individual byte에 access할 수 있습니다. 이 notation은 Data Block value를 byte의 0-based integer-indexed sequence로 나타냅니다. 예를 들어 dataBlock가 5 byte Data Block value이면 dataBlock[2]를 사용하여 그 3rd byte에 access할 수 있습니다.

여러 agent에서 concurrently referenced될 수 있는 memory에 resides하는 data block은 Shared Data Block으로 지정됩니다. Shared Data Block은 (Shared Data Block value의 equality testing 목적상) address-free인 identity를 가집니다. 이는 block이 어떤 process에 mapped되는 virtual address에 묶이는 것이 아니라, block이 나타내는 memory의 location set에 묶입니다. 두 data block은 자신들이 포함하는 location set이 equal할 때만 equal합니다. 그렇지 않으면 equal하지 않으며 자신들이 포함하는 location set의 intersection은 empty입니다. 마지막으로, Shared Data Block은 Data Block과 distinguished될 수 있습니다.

Shared Data Block의 semantics는 memory model에 의해 Shared Data Block event를 사용하여 정의됩니다. 아래 abstract operation은 Shared Data Block event를 도입하며 evaluation semantics와 memory model의 event semantics 사이의 interface로 동작합니다. event는 candidate execution을 형성하고, memory model은 그 위에서 filter로 동작합니다. full semantics는 memory model을 참조하십시오.

Shared Data Block eventmemory model에 정의된 Record로 modelled됩니다.

다음 abstract operation은 Data Block value를 대상으로 operate하기 위해 이 명세에서 사용됩니다:

6.2.9.1 CreateByteDataBlock ( size )

The abstract operation CreateByteDataBlock takes argument size (a non-negative integer) and returns either a normal completion containing a Data Block or a throw completion. It performs the following steps when called:

  1. size > 253 - 1이면, RangeError exception을 throw한다.
  2. dataBlocksize byte로 구성된 새 Data Block value로 둔다. 그러한 Data Block을 생성하는 것이 impossible하면, RangeError exception을 throw한다.
  3. dataBlock의 모든 byte를 0으로 설정한다.
  4. dataBlock를 반환한다.

6.2.9.2 CreateSharedByteDataBlock ( size )

The abstract operation CreateSharedByteDataBlock takes argument size (a non-negative integer) and returns either a normal completion containing a Shared Data Block or a throw completion. It performs the following steps when called:

  1. dataBlocksize byte로 구성된 새 Shared Data Block value로 둔다. 그러한 Shared Data Block을 생성하는 것이 impossible하면, RangeError exception을 throw한다.
  2. agentRecordsurrounding agentAgent Record로 둔다.
  3. executionagentRecord.[[CandidateExecution]]으로 둔다.
  4. eventsRecord[[AgentSignifier]]AgentSignifier()인 execution.[[EventsRecords]]Agent Events Record로 둔다.
  5. zero를 « 0 »로 둔다.
  6. dataBlock의 각 index index에 대해, 다음을 수행한다.
    1. WriteSharedMemory { [[Order]]: init, [[NoTear]]: true, [[Block]]: dataBlock, [[ByteIndex]]: index, [[ElementSize]]: 1, [[Payload]]: zero }를 eventsRecord.[[EventList]]에 append한다.
  7. dataBlock를 반환한다.

6.2.9.3 CopyDataBlockBytes ( toBlock, toIndex, fromBlock, fromIndex, count )

The abstract operation CopyDataBlockBytes takes arguments toBlock (a Data Block or a Shared Data Block), toIndex (a non-negative integer), fromBlock (a Data Block or a Shared Data Block), fromIndex (a non-negative integer), and count (a non-negative integer) and returns unused. It performs the following steps when called:

  1. Assert: fromBlocktoBlock은 distinct value이다.
  2. fromSizefromBlock 안의 byte 수로 둔다.
  3. Assert: fromIndex + countfromSize.
  4. toSizetoBlock 안의 byte 수로 둔다.
  5. Assert: toIndex + counttoSize.
  6. count > 0인 동안 Repeat한다.
    1. fromBlockShared Data Block이면, 다음을 수행한다.
      1. agentRecordsurrounding agentAgent Record로 둔다.
      2. executionagentRecord.[[CandidateExecution]]으로 둔다.
      3. eventsRecord[[AgentSignifier]]AgentSignifier()인 execution.[[EventsRecords]]Agent Events Record로 둔다.
      4. bytes를 nondeterministically chosen byte value를 sole element로 하는 List로 둔다.
      5. NOTE: implementation에서 bytes는 underlying hardware의 non-atomic read instruction 결과이다. nondeterminism은 weak consistency를 가진 hardware의 observable behaviour를 describe하기 위한 memory model의 semantic prescription이다.
      6. readEventReadSharedMemory { [[Order]]: unordered, [[NoTear]]: true, [[Block]]: fromBlock, [[ByteIndex]]: fromIndex, [[ElementSize]]: 1 }로 둔다.
      7. readEventeventsRecord.[[EventList]]에 append한다.
      8. Chosen Value Record { [[Event]]: readEvent, [[ChosenValue]]: bytes }를 execution.[[ChosenValues]]에 append한다.
      9. toBlockShared Data Block이면, 다음을 수행한다.
        1. WriteSharedMemory { [[Order]]: unordered, [[NoTear]]: true, [[Block]]: toBlock, [[ByteIndex]]: toIndex, [[ElementSize]]: 1, [[Payload]]: bytes }를 eventsRecord.[[EventList]]에 append한다.
      10. 그렇지 않으면,
        1. toBlock[toIndex]를 bytes[0]로 설정한다.
    2. 그렇지 않으면,
      1. Assert: toBlockShared Data Block이 아니다.
      2. toBlock[toIndex]를 fromBlock[fromIndex]로 설정한다.
    3. toIndextoIndex + 1로 설정한다.
    4. fromIndexfromIndex + 1로 설정한다.
    5. countcount - 1로 설정한다.
  7. unused를 반환한다.

6.2.10 PrivateElement Specification Type

PrivateElement 타입은 비공개 클래스 필드, 메서드 및 접근자 명세에서 사용되는 Record이다. Property Descriptor는 비공개 요소에 사용되지 않지만, 비공개 필드는 구성 불가능하고 열거 불가능하며 쓰기 가능한 데이터 프로퍼티와 유사하게 동작하고, 비공개 메서드는 구성 불가능하고 열거 불가능하며 쓰기 불가능한 데이터 프로퍼티와 유사하게 동작하며, 비공개 접근자는 구성 불가능하고 열거 불가능한 접근자 프로퍼티와 유사하게 동작한다.

PrivateElement 타입의 값은 Table 9에 의해 필드가 정의되는 Record 값이다. 이러한 값은 PrivateElements라고 한다.

Table 9: PrivateElement Fields
Field Name 그것이 present하는 [[Kind]] field의 Values Value Meaning
[[Key]] All Private Name field, method, 또는 accessor의 name입니다.
[[Kind]] All field, method, or accessor element의 kind입니다.
[[Value]] field and method ECMAScript language value field의 value입니다.
[[Get]] accessor function object 또는 undefined private accessor의 getter입니다.
[[Set]] accessor function object 또는 undefined private accessor의 setter입니다.

6.2.11 ClassFieldDefinition Record Specification Type

ClassFieldDefinition 타입은 클래스 필드 명세에서 사용되는 Record이다.

ClassFieldDefinition 타입의 값은 Table 10에 의해 필드가 정의되는 Record 값이다. 이러한 값은 ClassFieldDefinition Records라고 한다.

Table 10: ClassFieldDefinition Record Fields
Field Name Value Meaning
[[Name]] Private Name, String, 또는 Symbol field의 name입니다.
[[Initializer]] ECMAScript function object 또는 empty field의 initializer입니다(있다면).

6.2.12 Private Names

Private Name specification type은 private class element(field, method, accessor)의 key를 나타내는 globally unique value(그 밖에는 indistinguishable하더라도 다른 어떤 Private Name과도 다른 value)를 설명하는 데 사용됩니다. 각 Private Name은 String인 immutable [[Description]] internal slot을 가집니다. Private Name은 PrivateFieldAdd 또는 PrivateMethodOrAccessorAdd를 사용하여 어떤 ECMAScript object에도 installed될 수 있으며, 그런 다음 PrivateGetPrivateSet을 사용하여 read 또는 written될 수 있습니다.

6.2.13 ClassStaticBlockDefinition Record Specification Type

ClassStaticBlockDefinition Record는 class static initialization block을 위한 executable code를 encapsulate하는 데 사용되는 Record value입니다.

ClassStaticBlockDefinition Record는 Table 11에 listed된 field를 가집니다.

Table 11: ClassStaticBlockDefinition Record Fields
Field Name Value Meaning
[[BodyFunction]] ECMAScript function object class의 static initialization 중에 called될 function object입니다.