Private Names and Methods

Allen Wirfs-Brock allen at
Fri Apr 6 09:14:19 PDT 2012

On Apr 6, 2012, at 1:19 AM, Herby Vojčík wrote:

> Brendan Eich wrote:
>> Allen Wirfs-Brock wrote:
>>> But you should want to do that renaming because the helper is no
>>> longer a method so making it a function that references "this" would
>>> just be a likely source of confusion concerning the intended use of
>>> the function
>> IOW, OOP-uber-alles does not work and is not necessary in JS. This is
>> considered a virtue by some, a vice by others. Discuss!
> Yes, I agree, +1.
> If something is "method-like" I do not see why not to use this/call/apply. It may as well be "helper pluggable-function" (there may be a bunch of them an d I can call that bunch a "dynamic mixin"), there is no law that "helper" can only be a function.
> And what's not object-oriented there? They are still objects (as per "X is object iff X has identity, state and behaviour" except behaviour is not necessarily declared statically and at one place).

Keven's original problem statement imposed the requirement that refactoring a method to use a "helper" retained the ability to individually move the method to a different object without moving any associated "private methods".  Such a refactoring can only be accomplished by decomposing the method into lexically bound helper functions rather than dynamically (invocation) bound helper methods.   There is nothing wrong with the sort of decomposition you are referring to.  It just doesn't work for Kevin's problem statement (in any language).


More information about the es-discuss mailing list