archives

« Bugzilla Issues Index

#3930 — 9.2.3 [[Construct]]: Disallow tail calls in class constructors


9.2.3 [[Construct]] ( argumentsList, newTarget)

Tail calls in class constructors should not allowed for the reasons outlined in bug 3684 comment 2.


I'm not sure what problem you see in 9.2.3. It creates a new execution for running the constructor but any state it needs after returning from evaluating the constructor body (thisArgument, envRec, kind) should have been captured as part of the original execution context.

(admittedly, the spec. is a but sloppy in dealing with the boundary between spec. meta-level variables and actual runtime state, but I think the specification intent is clear enough here)


I was under the impression that retaining a reference to `envRec` is not valid under the tail-call semantics described in 14.6.3. But OTOH a reference to `envRec` is probably not too different from a closure within a constructor method (from the resource allocation point of view).