0

In ECMA-262, version 5.x (aka. ECMAScript 5 | ES5), there used to be a section 13.2 called Creating Function Objects.

I have been searching through the latest version of the standard, ECMAScript 2017 (aka. ECMAScript 8 | ES8), but cannot find a similar description.

Section 14.1 in ES8 is called Function Definitions, which is the same as section 13 in ES5. That's as far as I get.

Did they remove that whole piece? I thought it was a very helpful description of what actually happens when a new function is defined.

Magnus
  • 6,791
  • 8
  • 53
  • 84
  • 2
    [14.1.20: Runtime Semantics: InstantiateFunctionObject](https://www.ecma-international.org/ecma-262/8.0/index.html#sec-function-definitions-runtime-semantics-instantiatefunctionobject) + [14.1.21: Runtime Semantics: Evaluation](https://www.ecma-international.org/ecma-262/8.0/index.html#sec-function-definitions-runtime-semantics-evaluation) – Andreas Mar 26 '18 at 17:10
  • @Andreas Thank you. Ugh, they have made it extremely hard to follow how default properties are created and set. I was specifically looking for the .prototype and .constructor properties, and how they come to be. – Magnus Mar 26 '18 at 17:22

1 Answers1

1

As there are many more kinds of function object and function syntaxes, this changed a bit.

In ES5 we had

10 Executable Code and Execution Contexts
     …
10.4 Establishing an Execution Context
       …
10.4.3 Entering Function Code
10.5 Declaration Binding Instantiation
10.6 Arguments Object
   …
13 Function Definition
     (syntax and evaluation of declarations and expressions)
13.1 Strict Mode Restrictions
13.2 Creating Function Objects
13.2.1 [[Call]]
13.2.2 [[Construct]]
13.2.3 The [[ThrowTypeError]] Function Object

In ES8 we have

 9 Ordinary and Exotic Objects Behaviours
 9.1 Ordinary Object Internal Methods and Internal Slots
 9.2 ECMAScript Function Objects
 9.2.1 [[Call]] ( thisArgument, argumentsList )
 9.2.2 [[Construct]] ( argumentsList, newTarget )
 9.2.3 FunctionAllocate ( functionPrototype, strict, functionKind )
 9.2.4 FunctionInitialize ( F, kind, ParameterList, Body, Scope )
 9.2.5 FunctionCreate ( kind, ParameterList, Body, Scope, Strict [ , prototype ] )
 9.2.6 GeneratorFunctionCreate ( kind, ParameterList, Body, Scope, Strict )
       …  
14 ECMAScript Language: Functions and Classes
14.1 Function Definitions
        …
14.1.18 RS: EvaluateBody
14.1.19 RS: IteratorBindingInitialization
14.1.20 RS: InstantiateFunctionObject
14.1.21 RS: Evaluation
14.2 Arrow Function Definitions
        …
14.3 Method Definitions
        …
14.4 Generator Function Definitions
        …
14.5 Class Definitions
        …
14.6 Async Function Definitions
        …
14.7 Async Arrow Function Definitions
        …
     …
Bergi
  • 630,263
  • 148
  • 957
  • 1,375