Re: Mutability of functions in ECMAScript
- --- In email@example.com, "Kris Zyp" <kris@...> wrote:
> > If functions were immutable, joining would be a transparentoptimization.
> > Apart from the theoretical potential for backward incompatibility, whyfunctions is pretty core functionality, and AFAIK it is necessary to
> > isn't this a better solution? I suspect that very few programs rely on
> > mutating actual functions
> Really? It is actually even used in ADsafe's core library. Mutating
form multi-level prototypical inheritance. If I want object A to
delegate/inherit from preexisting object B, I must create a function
and set the prototype (a mutation) to object B and then construct with
that function. See the beget function in ADsafe.
beget is a workaround for the lack of an operator that produces an
object with a delegation relationship. It should not be interpreted as
proof that mutable functions are desirable.