onchange event

Garrett Smith dhtmlkitchen at gmail.com
Mon Mar 9 11:06:30 PDT 2009


On Mon, Mar 9, 2009 at 8:35 AM, Jeff Watkins <watkins at apple.com> wrote:
> Garrett, I gave a specific use case for why I'd like to be able to specify
> the name on an anonymous function: wrapping an existing function with pre-
> or post-call behaviour.

I think I get it.

It seems like just giving the function a name (not *anonymous*) would
fulfill that need.

Example:-

<script>
var getX = (function(){
  var x = 10;
  function getX() {
    return x;
  }
  return getX;
})();

document.write(getX.name + ": " + getX());
</script>


> I don't think the desire to trigger a function on change of a value is at
> all ludicrous.

What would the type of the variable be? Number? A number with a
behavior? How would you modify ToNumber or ToObject to accomodate for
those changes?

If an object is wanted, an object should be used. Objects encapsulate
behavior; primitives do not.

I think we should cut Memolus some slack for not being at his
> most articulate.

Sorry, I think the code says enough.

Garrett

> On 8 Mar, 2009, at 6:51 PM, Garrett Smith wrote:
>
> Memolus does not say what he needs this for, but it sounds even more
> ludicrous than the recent discussion to allow [[Writable]] name to
> anonymous function objects created in a certain way because the
> "Objective-J" folks wanted it (what was that use case?)
>
>


More information about the Es-discuss mailing list