Hi,
Sure, in approach 2, you can no longer delete the properties.
(Not sure about your syntax for that second approach, btw).
Best,
Tobie
On May 3, 12:48 pm, gcalm <[EMAIL PROTECTED]> wrote:
> Hi guys,
>
> I have a question about the implementation of the Object.extend (<=
> v1.6).
>
> Can you (very) briefly discuss the tradeoffs between the following two
> approaches and the motivation for choosing the first one for the
> framework.
>
> Thank you.
>
> Regards,
> GC
>
> =========== Approach 1 (current) =====
>
> Object.extend = function (a, b) {
> for (var c in b) {
> a[c] = b[c];
> }
> return a;
>
> }
>
> ---------------------------------------------------------------
>
> =========== Approach 2 ===========
>
> Object.extend = function (a, b) {
> var E = function() {};
> E.prototype = b.prototype;
> a.prototype = new E();
> a.prototype.constructor = a;
> return a;
>
> }
>
> ---------------------------------------------------------------
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---