On Wed, Mar 12, 2008 at 3:35 PM, Zoltán Németh <[EMAIL PROTECTED]>
wrote:

> 2008. 03. 12, szerda keltezéssel 15.20-kor Robert Cummings ezt írta:
> > Even JavaScript has it.
>
> oh yes, I could have thought of that. in JS you can assign a function to
> a property or variable at runtime, even I did something similar, when I
> assign the action functions of the buttons of a modal dialog
> dynamically. it's good because the same simple JS library can handle any
> number of use cases, and my main page with the JS libraries load only
> once, ajax does the rest of stuff, so I could not change the class
> definition for the separate cases.
> but on server side, why not throw everything you might need in the class
> definition?


javascript has this neat concept of execution context.  so a single function
can work w/ any 'class' or more precisely, any object.

a = {d : 5};
b = {d : 6};
function c() { alert(this.d); }
c.apply(a);
c.apply(b);

quite interesting.

-nathan

Reply via email to