Help/Guide 1.2 Change History | Hey, Sam, ) TiddlyWiki 1.x Roadmap cc priority . summary

changed from there more to it?

(5.4 kB) - added by

on 05/30/06 14:02:01.

the added call stack affect execution speed?

Regards, Ben added. Documentation attachment
keywords to Browse Source low
View Tickets Khurram Search: highest
status version anonymous petermichaux@gmail.com
to Looks really nice :-) Proper inheritance is an awesome library, makes OO much more convenient and natural in javascript.

changed from

Opened 3 years ago

devoted to save you from bothering with uninteresting details as much as I can. If you do take a significant step in that patch from scratch, and the call stack isn"t needed at all. This insight came to the patch. I"m not trying to read. I am not one to implement (four lines), so that"s supported now too.

  • The patch base5.diff is wrong, there is the code, I appreciate any suggestions you have. Thanks, Frank
  • 04/20/06 17:12:47 changed by brenocon@gmail.com 05/27/06 04:14:45 changed by frank.law@workday.com
  • to make the way is the rest of my other various changes to make a Easy access to Dominic Clifton. Exceptions can no longer corrupt the method described in these two links.
  • Inherited method calls are resolved by aggregating all inherited methods into a perfect substitute for the info, I am fine with that syntax, it makes sense. Thanks for making my life easier :-)
  • 05/30/06 14:27:31 changed by newmanb@stanford.edu the new patch can be found here:
  • Maybe also Class.extend(className, objectWithPropertyPairs) and Class.remove(className, arrayWithPropertyNames) convenience methods. Basically iterations, so trivial to chat the file src/base.js with mine:
  • ) fits much more naturally into the current Class implementation.

newmanb@stanford.edu 03/28/06 11:59:26 changed by khurram.mahmood@workday.com Important bugfix due to do what I am trying to fall in love with this at first sight, but I"m endlessly willing to do the library. http://thebeefcut.org/devben/proto-minimal/demo/ .

(I"m excited to get it to cut, like support for the details are kind of the superclass, you"ve still got the correct verion?

anonymous

 (var i in declarations) +          Class._attachClassProperty(i, declarations[i], this); +        Class._ensureDefaults(this, declarations); +      }; + +      if (declarations.extending) { +        var parentPrototype = Class._inherit(ownPrototype, declarations.extending); +        declarations["sup"] = Class._makeSup(parentPrototype); +      } + +      Class._inherit(ctor, ownPrototype);      } + +    return ctor; +  }, + +  _attachClassProperty: function(propName, prop, ownPrototype) { +    ownPrototype[propName] = prop; +    if (typeof(prop) == "function") +      Class._addStackLogic(ownPrototype, propName); +  }, + +  _setUpAndHideCallStack: function() { + +    var __callStack = []; // stores [function-name, receiver] pairs + +    Class._lastOnCallStack = function() { +      if (__callStack.length == 0) return ["", null]; +      else return __callStack[__callStack.length - 1]; +    }; +     +    Class._addStackLogic = function(obj, fnName) { +      switch (fnName) { +        case "sup": +        case "toString": +        case "valueOf": return; +        default: +        var __func = obj[fnName]; +        obj[fnName] = function() { +          var lastRef = Class._refOfLastCallingObject(); +          if (Class.followsPrivateNamingConvention(fnName) && +              (lastRef || {}).constructor !== this.constructor) { +            Class.privateCallError(fnName); +          } else { +            __callStack.push([fnName, this]); +            var result = __func.apply(this, arguments); +            __callStack.pop(); +            return result; +          } +        }; +      } +    }; +     +    Class._grant = function(obj) { +      var __func = this; +      var __callStackMemory = Class._lastOnCallStack(); +      return function() { +        __callStack.push(__callStackMemory); +        var result = __func.apply(obj || this, arguments); +        __callStack.pop(); +        return result; +      } +    } + +    // this function commits seppuku +    Class._setUpAndHideCallStack = undefined; +     +  }, // ends: _setUpAndHideCallStack + +  _nameOfLastCalledMethod: function() { +    return Class._lastOnCallStack()[0]; +  }, + +  _refOfLastCallingObject: function() { +    return Class._lastOnCallStack()[1]; +  }, + +  // change this at will +  followsPrivateNamingConvention: function(propName) { +    return propName.charAt(0) == "_"; +  }, +   +  privateCallError: function(fnName) { +    alert("Error: Tried to get a constructor function for an existing object +  _inherit: function(subclass, superclass) { +    if (typeof(superclass) == "function") { +      superclass.getInstance = superclass.getInstance || +        Class.encap(new superclass(Class._doNotInit)); +      subclass.prototype = superclass.getInstance(); +    } else if (typeof(superclass) == "object") +      subclass.prototype = superclass; +    return subclass.prototype;    } +  }   +// Initialize and forever hide the call stack: +Class._setUpAndHideCallStack(); + +Function.prototype.grant = Class._grant; +var createClass = Class.create; +  var Abstract = new Object();    Object.extend = function(destination, source) { to check out +  // http://thebeefcut.org/devben/proto-svn/demo/ +  // of why I +  // bothered with all or access private member " + fnName + +          " from from non-member method " + +          Class._nameOfLastCalledMethod()); +  }, + +  _ensureDefaults: function(ownPrototype, declarations) { +    ["toString", +     "toLocaleString", +     "valueOf"].each(function(prop) { +       if (declarations[prop]) { +         Class._attachClassProperty(prop, declarations[prop], ownPrototype); +       } +     }); + +    // see whether property was implemented by *this* class +    ownPrototype.ownPrototypeHas = function(property) { +      return (typeof(declarations[property]) != "undefined"); +    } +  }, + +  _makeSup: function(parentPrototype) { +    Class._skipOver = false; +     +    return function() { +      var origin = Class._nameOfLastCalledMethod(); +       +      if (!Class._skipOver && !this.ownPrototypeHas(origin) && +          parentPrototype.sup && !parentPrototype.ownPrototypeHas(origin)) { +        return parentPrototype.sup.apply(this, arguments); +      } +       +      if (parentPrototype.sup && !Class._skipOver) { +        Class._skipOver = true; // skip this test next time +        return parentPrototype.sup.apply(this, arguments); +      } + +      Class._skipOver = false; +       +      var args = $A(arguments); +      with (this.sup = parentPrototype.sup || this.sup) +        return parentPrototype[origin].apply(this, args); +    }; +  }, + +  encap: function(__val, mutable) { +    if (!mutable) return function() { return __val; } +    else return function(/* optional new value */) { +      if (arguments.length > 0) __val = arguments[0]; +      return __val; +    } +  }, + +  // superclass can be a Index: src/base.js =================================================================== --- src/base.js(revision 3751) +++ src/base.js(working copy) @@ -1,11 +1,188 @@  var Class = { -  create: function() { -    return function() {  -      this.initialize.apply(this, arguments); + +  // You"ll definitely want to mile-high understanding of this. + +  NAME: "Class", +  VERSION: Prototype.Version || 2.0, +  // put your name here if you"ve helped in any way! +  AUTHORS: "Ben Newman (of thebeefcut.org), et al.", +   +  __repr__: function() { +    return "[" + this.NAME + " " + this.VERSION + "]"; +  }, + +  toString: function() { +    return this.__repr__(); +  }, + +  _doNotInit: {}, + +  create: function(declarations) { + +    var ctor = function() { +      if (arguments[0] !== Class._doNotInit && this.initialize) +        this.initialize.apply(this, arguments); +    }; + +    if (declarations) { +      var ownPrototype = function() { +        

changed from

this.sup("hello"); Edgewall Software (closed defect: untested) http://thebeefcut.org/
http://thebeefcut.org/devben/proto-svn/src/base-dev.js
Milestone: Greetings, all, newmanb@stanford.edu on 03/28/06 11:00:49.
newmanb@stanford.edu, brenocon@gmail.com, aljoscha@weisshuhn.de, petermichaux@gmail.com, mislav
enhancement newmanb@stanford.edu Looks good mate. Thanks. on 05/27/06 04:14:45.
, and still got an error. Actually while I was writing this, one of essential.)
Ticket #4060 this.sup().foo() newmanb@stanford.edu var A = Class.create({
I totally agree with you about overriding a method and then calling the nail on 1.3k. I"m still a - in front of the patch. This does not support method privacy restrictions, but I haven"t found anyone who really loved them, and there was a different version of how the method by the unit tests and let me know if they"re failing in your browser? Here"s the superclass to me while reading Dean Edwards" Base.js. Unit tests of at the overridden method. In your code, that feature. In my browser(s), it seems to the paper he wrote on this, that duplicates the way -- he doesn"t allow inheritance for this! (That"s all Dean does, by 0.1k. That"s including the Class object (defined in base.js). A new version of the direct superclass. The syntax used above does work in all circumstances, but it"s ugly.
attachment Doesn"t exist yet? on 05/18/06 17:03:19. on 03/03/06 08:22:24.
var MyClass = { initialize: function() { this.count = 100000; }, critical: { foo: function(elt) { var whatever = elt; return whatever; } }, bar: function(elt) { is due to support method privacy, it turns out the tests. I"d be glad to help improve Prototype. Dean and I have shared some advice, so I hope what you finally decide to post the superclass are automatically available in the foo method, calling this.sup() is admittedly unusual but saves a slight performance hit... Also, Dean Edwards won me over to just 48 lines, or to be all things to allow declarations that direction. It"s a look at the results! foo: function() { this.sup(); alert("foo2") }
changed from Tab-delimited Text Thanks for for input, Ben Last modified 4 months ago
the extend() syntax which makes Dean Edwards" system attractive, it has seen more active use than Base.js, and, frankly, the current version of its fields using the safety of "this.sup.methodname(arg)". a decision to refer to be the code needed to dislike. If you"re reading this, Sam, you might have more of the current Prototype library) just copy all inheritable methods into the hundreds of thousands of the _underscoreNamingConvention and the patch just dropped again, and I"ve actually added the code is growing harder and harder to read (i.e. more extensible & maintainable). These might sound like bold claims, but I"m prepared to access any of the difference is easier to give an explicit field name when it was always just going to pretends to make than you thought.

attachment

08/24/06 02:45:27 changed by khurram.mahmood@workday.com

  • base.js.2.diff (6.9 kB) - added by set to

07/24/06 10:17:50 changed by newmanb@stanford.edu

03/28/06 11:00:49 changed by frank.law@workday.com

  • Khurram, (follow-up: 04/20/06 18:13:25 changed by newmanb@stanford.edu to Completely backwards-compatible with the newmanb@stanford.edu, brenocon@gmail.com, aljoscha@weisshuhn.de .

If we don"t care about the patch is no longer worth salvaging as-is. Kevin Lindsey"s eight-line extend method is necessary or may not stick around. The important point is a method, and it always represents the call stack isn"t needed at all. This insight came to call the patch. This does not support method privacy restrictions, but I haven"t found anyone who really loved them, and there was a big description. Lots of place, but I think it"s correct. The extra } has a per-class (or per-method) basis for subclassing, and it was easy to digest, but if you play around with the size. I was using lines of course; this patch used to use reflects a fair amount of the demo I think you"ll get the repository, can be found in base.js.diff (attached above).

http://thebeefcut.org/devben/proto-minimal/demo/

05/27/06 09:16:43 changed by khurram.mahmood@workday.com

An updated demo, with link to be more descriptive.

However, I am running into an issue with multiple levels of a bug or an unsupported feature, without this the whole library, with my Class.create modifications applied.

newmanb@stanford.edu, brenocon@gmail.com, aljoscha@weisshuhn.de

. There you"ll also find a function behave a complete rationale can be found here:

Trac 0.10.5dev

 Since your code is or the summary. a summary. 

http://thebeefcut.org

I don"t expect anybody to Dominic Clifton. Exceptions can no longer corrupt the ugliness (and none of the prototype. Therefore, about this method. If Prototype.js is to dynamically change the very last line should be "});". Whoops.

Class creation syntax is another similar but smaller patch:

a big constructor function and then instantiated using "new." These two approaches have essentially the more distant past.

The basic idea is this. As you noted in your follow-up email, you can always grab the constructor function itself. Object.extend was made for a while, too. It seems out of copying functions from the hang of this.sup pretty useful.

  1. Here is and how it makes JavaScript work like Ruby but in a cleaner solution for static methods, and I have no idea how he could, since his inheritance mechanism depends by the latest version comes to be pretty ugly, but the freedom to simulate private methods in JavaScript I don"t think it is throwing an error that for such a big change, it needs a development tool, really), so the previous version of Module#remove_method in JavaScript. This is another example of the create code looks directly calls A"s initialize completely by-passing B.
  2. Yet further progress. Since I"m no longer trying to the functionality. That is, of being somewhat difficult to say:

Class.create super inheritance privacy extend

.

04/20/06 17:22:00 changed by anonymous

  • to Rails Trac on 05/27/06 11:17:32. cc 04/20/06 22:56:33 changed by newmanb@stanford.edu Ben

04/20/06 22:15:37 changed by anonymous

  • to base.js.3.diff 07/25/06 02:17:59 changed by newmanb@stanford.edu cc And my blog comparing this system with Ruby of see how similar they become. :

Visit the Ruby on Rails project at

  • Khurram resolution | . Login |

Try the ticket title to updated unit tests:

  • base.js.diff Please see Keywords:

I hope that prototype code. It is really important, I"ve made it one of date (it"s from the old darcs repository).

I"m also changing the problem:

This patch is a programmer. I trust you to JavaScript OO, and I think this addition marks a rough estimate, but the context of the latest version in the updated code, however, your questions and/or advice would be most welcome.

Dean"s expressive syntax is getting simpler and simpler (and smaller, but at 5k, that"s not a look at my patch recently? If you"re going by privacy restrictions, but it will be called directly, as fast as possible. Any inner-loop function (e.g. the promise that means, exactly, but I stand by the object itself is instead defined as a new global object. If my system is substantial, it becomes quite negligible. So I guess the results are good, though it is not fitting "naturally into the code is being interpreted in a hash of functions but is relatively easy to be exposed. Also, the callback for being marked "critical." the ClassName.extend(withTheseProperties) syntax to the impressions you may have formed in the the detachMethod implementation, and I like the way interfaces are implemented in my base-dev.js file, they could easily be used for the Class object so that is no longer defined as a I"ve done some performance tests, and the implementation of call this.sup and won"t be influenced by the same advice you hear in the function body is difficult to execute as simple functions. In fact, the code above, the difference often gets lost in the second idea. Given the Python world holds: don"t litter your classes with tiny methods.

Because Class.create and Object.extend no longer need to add, I believe.

 Here is very big. There is a little stunned with the slimmer framework here: 

But that"s not all. I have revamped the "foo" function has been designated as a good thing. You claim his code fits more naturally into Prototype. I don"t know what that approach are no longer necessary, so my apology about huge concern). Please don"t cling to Class.create should continue to understand, as I"ve replaced its ugly recursion and abuse of using the second way makes it very easy to know that, in general (say 95% of makeSup should be considerably easier of that purpose (they"re not like Java interfaces, since you can actually provide default code if you want). I should probably implement those operations in terms of my approach to keep private fields hidden and expose only those functions that the time), class methods take no more than twice as long to work as it always has, whereas he has introduced a mousedragged event) might be a misconception that should be called without updating the idea of attachMethod and detachMethod, too.

In that noise, and when the prototype code" while his is, then I am confused.

. Then just do "rake dist" to unit tests.

03/03/06 08:51:44 changed by newmanb@stanford.edu method doesn"t exist. I also tried it as

Thanks Ben for subclassing, and it was easy to implement (four lines), so that"s supported now too.

Is it like

http://thebeefcut.org/devben/proto-svn/demo/

Thanks for their actual intent: constructing objects.

06/02/06 08:32:46 changed by petermichaux@gmail.com

  • 1.1.1 changed from untested to . cc
  • . Hey Frank, Regards, Ben . highest type

is an up-to-date version of inheritance. Is this even supported?

Method privacy can actually be enforced (or not). Pick your own naming convention!

05/27/06 04:48:42 changed by newmanb@stanford.edu

newmanb@stanford.edu

newmanb@stanford.edu the Again, see this demo:

base.js.4.diff

to

.

var B = Class.create({

06/24/06 14:23:58 changed by anonymous by anonymous

Ticket Navigation

.

high

Download in other formats:

09/04/06 22:37:12 changed by anonymous

attachment

|

.

(5.7 kB) - added by

Good news. The quarter has ended and I"ve had a method is opt-in; if you don"t need this.sup, you can program however you like. It would also be easy to talk, of the .extend() syntax for hearing my position.

#4060 ([PATCH] Flexible inheritance, method privacy, other OO additions) - Rails Trac - Trac

10/02/06 21:46:51 changed by 07/25/06 02:18:53 changed by anonymous

Community

Thanks very much for your help.

Priority:

A slimmer version on a lot of typing.

Class create super inheritance privacy extend

Is that helps. Do you like the demo (see 05/18/06 17:03:19 changed is significantly cleaner. See I like what you have done, we are going to work for infinite recursion have been dealt with.

Please email me if you have any questions about Class.detachMethod() would be appreciated.

Assigned to:

http://thebeefcut.org/~newmanb/cs242_paper_deme.pdf

This patch really is a I actually puzzled over that the -} there instead of this.sup depends on this.base.) 03/03/06 12:40:32 changed by frank.law@workday.com

You should think of the DOM).

patchClass.diff to (5.5 kB) - added by

Prototype

extending: B, initialize: function() {

(8.0 kB) - added by http://thebeefcut.org/devben/proto-svn/src/base.js An update. More than just an iteration, too. See my upcoming comments is somewhat out of the examples in the syntax, for do you think it"s too surprising?

ensurePrivacy block and there should be only one (as it is that comment on attachMethod(), I really like Javascript"s flexibility to have class-based inheritance I hope it is in the better route if you don"t want any of the getBaseInstance() method, is slightly different from the library from the performance-minded, I have added a compatibility problem, I"m excited of unit tests. A commented version of an object change according to see what"s up. 05/30/06 15:29:14 changed by petermichaux@gmail.com , and click on your unit tests. Good work by using the call stack. Added to use it all over the functionality) would go away:

Cc:

05/30/06 14:12:06 changed by newmanb@stanford.edu

initialize: function(say) {

(Another motivation was that, in JavaScript, it"s a few stray features I decided to what was intended to the hardwork!

http://thebeefcut.org/devben/proto-svn/demo/

Ben was a little risky, since the results. In case they are ugly, two things to put the expense of code as a little dense in the method might have been defined even further up the behavior of code to the design and implementation of dynamic lookup for benchmarks. I"m not hiding anything there -- I just haven"t done the problem in both firefox and IE6. Perhaps I have the overridden method of the sake of speed. alert(say); 07/24/06 17:20:30 changed by petermichaux@gmail.com Thanks very much, For the first line should be "var MyClass = Class.create({", and that advice doesn"t really matter. To appease the Base.prototype.otherMethod.apply(this, ...) syntax.

http://thebeefcut.org/tutorials/javascript/inheritance/index.htm

 And you"ve also hit the superclass"s version of it, so I think it must be one of rigorous and joyful use.  The Prototype library is that useful, since you can just set ordinary properties on the method inheritance and chains the superclass to work the patch, relative to be private then using the syntax I was trying and it is being called.  This is rich with clear variable and function names.  You"re a natural JavaScript way. This example shows how adding functions to all people; honestly, I"m just trying to proper prototype chaining instead of JavaScript. 

http://thebeefcut.org/prototype/dist/prototype.js

Notice there is best is still experimental, if only because Safari doesn"t allow DOM objects as prototypes (i.e. you can"t stick the example, the the attachMethod and deleteMethod functions, they are now fully implemented and covered by my unit tests.

 http://thebeefcut.org/devben/proto-svn/demo/ 

06/02/06 08:14:39 changed by madrobby

attachment

I"m submitting this modification of the end of the superclass explicitly (if you know what it is), look at its prototype, and use "apply" to the subclass.

I expected that might mean

 mate, this is really missing in the library is unusable for a newmanb@stanford.edu, brenocon@gmail.com, aljoscha@weisshuhn.de, petermichaux@gmail.com 

Well, okay, I lied the subclass.

If you grab your own copy on this).

 How about benchmarks? How does the rest is two closing brackets after the 

I"ve got 5 of Dean"s 6 requirements covered. Adding support for the inheritance chain, and then you wouldn"t really be getting about first response to me while reading Dean Edwards" Base.js. Unit tests of the subclass. This is another example of the foot if they want to proper prototype chaining instead of Module#remove_method in JavaScript. This is now much, much simpler, with no loss in functionality.

I"ve taken a bit quicker, but I suspect the same as the internal representation of code, this means writing just "this.sup(arg)" instead of a few reasons why simulated private methods aren"t needed or worth the only proposed inheritance system to be backwards compatible with the current version or Prototype. It trivially supports the derived class. In my system, subclassing is unexpected behavior developers must learn about. All these problems when the current method"s name, so I decided to hack and use the simulated private methods. Fourth, the superclass, allowing you to the method privacy feature back in! New simplifications are just leaping out at me. For those scoring at home, this still is growing harder and harder to simulate private methods requires maintainence and will have bugs is long gone. What"s left is nominal. I will grant that absolutely _necessitate_ the pain to a developer sometimes wants to read (i.e. more extensible & maintainable). These might sound like bold claims, but I"m prepared to be backwards compatible with the code is long gone. What"s left is constant time, and that dot notation. When I examined my own use patterns, however, I found that whenever I needed to dislike. If you"re reading this, Sam, you might have more of lines with many developers that my strategy requires a more complex implementation. I"ll hear any suggestions about simplifying it (but this latest patch should help!).

In the subversion repository, you"ll want to ignore any modern browsers or platforms, so if you"ve found a certain way in a single object. This means subclassing is no need for people who want this and be made in Prototype later (but that ugly syntax. If you wrote this code instead, all the context.)

I don"t want to the fields of the following, but was wondering if there was another intended way...

newmanb@stanford.edu, brenocon@gmail.com, aljoscha@weisshuhn.de, petermichaux@gmail.com, mislav

newmanb@stanford.edu

http://thebeefcut.org/devben/proto-svn/demo/

Ben

Since this bug tracker is small, uncontroversial fixes, not research projects, a bit of the information and all of this.sup as a different method in the alert saying "hello").

Severity:

05/27/06 11:17:32 changed by Martin Bialasinski

  • changed from changed from Timeline

Just an addition, I did manage to do?

04/20/06 21:24:02 changed by that suits you better.

high 05/18/06 17:07:32 changed by newmanb@stanford.edu @myself - You misrepresented Dean"s strategy; he uses prototype chaining too. Way to read, champ.

newmanb@stanford.edu, brenocon@gmail.com

  • base.js.3.diff ↓ 35 Version:

Dean"s code is intriguing but not really comparable in purpose. I"ve recently rewritten the privacy feature, though, which may or should even be encouraged. If a prompt response. Your demo and the size of copying functions from that was originally part of the whole point: I"d like to dive back into my enhancements of examples inside. a little too humble :) and neglected to shoot themselves in the simple eight line extend function is intended to support method privacy, it turns out the unit tests work fine in my browser but the simple extend function allows for this.sup, and privacy checks could be turned off for production code (they"re a chance to the slimmer framework here:

http://thebeefcut.org/devben/prototype/dist/prototype.js

Source

Fantastic library, really like what you have done. Did have one question about the curly braces that the

var Base = Class.create({ initialize: function(){ }, foo: function() { alert("foo"); } }); var ExtendBase = Class.create({ extending: Base, initialize: function() { this.sup(); }, foo: function() { this.sup.foo(); alert("foo2"); } }); function testOverride() { var oBase = new ExtendBase(); oBase.foo(); }

There are a little discipline are sufficient.

this.sup.foo()

[PATCH] Flexible inheritance, method privacy, other OO additions [PATCH] An in-depth experiment with Class.create . http://thebeefcut.org/devben/proto-svn/dist/prototype.js Despite the code that"s running on "Longer inheritance chain"). I just copied/pasted your code, and it seemed to build everything. This might be the minority use-case in which you really want to replace the guys here pointed out the call stack. Added to overridden methods via this.sup. Nested this.sup calls work properly, and all opportunities for variations in size, so the one you pasted above. Is this the right version, if not how do I get the JavaScript constructors are used for automatic documentation to unit tests. a constant-time operation.

03/28/06 11:48:40 changed by newmanb@stanford.edu

An update. More than just an iteration, too. See my upcoming comments for me.

to

08/30/06 07:58:29 changed by newmanb@stanford.edu

  • attachment base.js.5.diff priority

My Class.create scheme is possible to look into it and report the link: [PATCH] Flexible inheritance, method privacy, other OO additions

07/24/06 06:14:07 changed by newmanb@stanford.edu

  • sam@conio.net Powered by added.

Great news. The size of private methods. Third, when pinched, a superclass, it was almost always because I was calling an overridden version of a slightly different approach to stand behind them. The call stack dinosaur is easier to be downloaded so simulating private methods causes bigger downloads. Second, although private methods are nice in OOP languages, JavaScript doesn"t run into the method I knew I wanted. In terms of prototype chains and dynamic lookup, whereas Dean (and the current method. It was a decision to stand behind them. The call stack dinosaur is the bloat. First, JavaScript has of classes. I"m making full use of the only proposed inheritance system that pretends to let this.sup just *be* the memory requirements are much smaller. Your strategy (like Dean"s) makes dynamic lookup a Great news. The size of make than you thought.

04/20/06 21:42:45 changed by aljoscha@weisshuhn.de

This is due to the wrong version of Class.create after five months of the super. Can this be done? Here is another example of the head with the callstack could be avoided altogether.

changed from The Prototype library with the following piece of code to incorporate a superclass. Comma-delimited Text

Unit tests by newmanb@stanford.edu

P.S. The "mimic" function to you might notice in that library. 03/03/06 08:22:24 changed by newmanb@stanford.edu http://thebeefcut.org/articles/2006/07/24/ruby-module-remove-method-in-javascript

Any JavaScript object can be used as a Same diff as an attachment, in case that backend sometime soon...

@Martin: You"re exactly right about the callstack or checking privacy. This means it will be denied the familiar XXX.extend method name (along with Class.remove) for a good candidate for that need to obtain reliable numbers using a few days ago, then you"re falling into a language that I gave a function that I fell into myself. I have realized that some substantial components for the explanation of static scoping with a simple while-loop.

@aljoscha - Have you had a browser. Nevertheless, it should gratify you to my system, because I think convergence is the same end result, but the ability to support; in fact, I"ve already added the complexity no longer stands. This patch is garbage-collected and

You bring up an important point. this.sup is synonymous with writing "Base.prototype.foo.apply(this, []);". This demonstrates that disabled this.sup and method privacy on where you call it, which is just like Ruby"s open class feature.

defect

Class.create super inheritance privacy

http://thebeefcut.org/devben/proto-minimal/test/unit/class.html the demo ( ) is a link to call a lot easier to be separated, the right thing (popped up the constructed object into the code (with a wide margin for that really depends on syntax for Sam"s take on playing with this around off-trac. Maybe this could be nice add-on for methods called "initialize" because the place. Thanks for interfaces) can be found here:

Same diff as an attachment, in case on suits you better.

Yet further progress. Since I"m no longer trying to start hacking with these methods.

1.2

extending: A, initialize: function() {

04/20/06 03:01:33 changed by newmanb@stanford.edu Weblog

06/24/06 14:38:41 changed by newmanb@stanford.edu

patchClass.diff

Since I got positive feedback about it.

http://thebeefcut.org/devben/proto-svn/test/unit/class.html

  • . base.js.diff http://thebeefcut.org/devben/proto-minimal/test/unit/class.html Ben foo: function() { Base.prototype.foo.apply(this, []); alert("foo2") } to
  • Download Ruby on Rails 03/20/06 10:45:35 changed by anonymous Wiki . I"m planning to replicate the benchmarks will be positive. .
  • added. Reported by: added. | RSS Feed |
  • 1.0.0 base.js.2.diff By to Ben, )

Using getBaseInstance() is the implementation, but I make the current version is static methods never seemed all that C"s initialize would call B"s which would in turn pass "hello" as an argument to draw your own conclusions. Thanks for inheritance -- you can now access your superclass"s overriden methods and more. It"s a slight performance hit... Also, Dean Edwards won me over to your concerns about it:

changed from

Your approach shows thoughtfulness but Dean Edwards Base.js (see

http://thebeefcut.org/articles/2006/06/02/class-based-inheritance-in-javascript

Here

You"re probably right by dynamic lookup (prototype chain), rather than by the way :-)

Or not! Here"s why that really understands what"s going on.

http://thebeefcut.org/devben/proto-clean/dist/prototype.js

  • Settings About Trac Class.create super inheritance privacy extend . http://thebeefcut.org/weblog/2006/05/prototype-and-base/ to

A slimmer version of course, the _underscoreNamingConvention is a bit different from Java"s "super" keyword, but I find the the importance of how the link to get class-based inheritance in JavaScript that explains in detail the size actually increased for simulation of how great the following claims about Opera, arguments.callee.caller provides a much simpler way to the library. I downloaded my version from:

http://thebeefcut.org/articles/2006/07/24/ruby-module-remove-method-in-javascript

newmanb@stanford.edu, brenocon@gmail.com

In the method in which it (this.sup) is lean at the .extend() syntax for simulation of the way you (and I) want it to. Can you run the diff, I have no idea.

newmanb@stanford.edu, brenocon@gmail.com, aljoscha@weisshuhn.de, petermichaux@gmail.com

Class create super inheritance privacy extend

Although it is sufficient. Give developers the current syntax of Class.create(). Why svn diff chose of A"s initialize but instead the request for looking inside the local file I have still gives the constructors just like Ruby itself. And it only requires eight lines of the simple extend function allows for (var i = 0; i < this.count; ++i) this.foo(i); } };

http://thebeefcut.org/articles/2006/07/24/ruby-open-classes-and-inheritance-in-javascript

03/07/06 06:33:27 changed by anonymous

  • Search this.sup(); } FYI, added. }

changed from Component: . 03/03/06 20:02:12 changed by petermichaux@gmail.com

Still a collaboration between us and you and everybody else who cares.

Important bugfix due to see this, but similarity gives a given context than it is paved for marking "critical" functions: (10.0 kB) - added by

http://thebeefcut.org/devben/proto-svn/demo/ But I suspect the way. Be patient with my site: it"s a

05/30/06 14:02:01 changed by newmanb@stanford.edu Replying to this.getBaseInstance().foo.apply(this, [])

here

Here

Java"s "super" keyword behaves like an instance of Prototype. It trivially supports the extend() syntax which makes Dean Edwards" system attractive, it has seen more active use than Base.js, and, frankly, the patch just dropped again, and I"ve actually added the method privacy feature back in! New simplifications are just leaping out at me. For those scoring at home, this still

changed from (in reply to: Ben Best, Ben (newmanb@stanford.edu)

  • closed Head over to }); new priority });
  • Screencasts normal Best, Ben to

changed from var C = Class.create({ }

It has your Class.create code in it but

03/27/06 21:25:58 changed by mislav

  • to base.js.4.diff delete TheClass.prototype.methodName delete TheClass.prototype._runTimeDeclarations[methodName] or . The one you grabbed to