Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6655913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:34:45+00:00 2026-05-26T01:34:45+00:00

We have a set of classes created that depend on Prototype’s Class implementation (and

  • 0

We have a set of classes created that depend on Prototype’s Class implementation (and some Object.extend).

The problem is prototype is creating trouble when integrating with the rest of our applications (even with “noconflict” adapters and the such).

Does anybody know of a compatible Class implementation that does not mess with the global scope? Or has anybody been able to “extract” Prototype’s to use it alone?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T01:34:45+00:00Added an answer on May 26, 2026 at 1:34 am

    I wrote one a couple of years back (I should go revisit it, and give it a proper name) because I didn’t like Prototype’s handling of calling methods on the “superclass”, which involves creating a function every time an overridden method is called (yes, really). It’s very similar to Prototype’s except for how you make supercalls; you can readily drop it in and search for super in your code and change it up. My implementation also makes it a bit easier to use named functions rather than anonymous ones, which is useful for many reasons, not least because it helps your tools help you. It also makes private “class” methods trivial. Details below.

    But you don’t have to use mine. There are other options that will require slightly more work to migrate your code to, but probably not a lot more:

    • John Resig’s simple inheritance
    • Dean Edwards’ mechanism

    My issue with both of them is that they use function decompilation (so does Prototype’s Class stuff), and function decompilation (e.g., calling toString on a function) has never been standardized and does not work on some mobile browsers. Resig’s mechanism continues to work if function decompilation doesn’t work, but it adds overhead to every method in that case (rather than only ones that make supercalls). My mechanism doesn’t use function decompilation at all, adds no overhead to method calls, and even makes supercalls highly-efficient.

    If you use my mechanism and your Prototype code looks like this:

    var SuperThingy = Class.create({
        foo: function(arg) {
            console.log("SuperThingy: " + arg);
            this._pseudoPrivate();
        },
        _pseudoPrivate: function() {
            console.log("I'm not really private.");
        }
    });
    var Thingy = Class.create(SuperThingy, {
        foo: function(super, arg) {
            console.log("Thingy: " + arg);
            super(arg);
        }
    });
    

    You can make minimal changes:

    var SuperThingy = Helper.makeClass({
        foo: function(arg) {
            console.log("SuperThingy: " + arg);
            this._pseudoPrivate();
        },
        _pseudoPrivate: function() {
            console.log("I'm not really private.");
        }
    });
    var Thingy = Helper.makeClass(SuperThingy, {
        foo: function(arg) {
            console.log("Thingy: " + arg);
            this.callSuper(arguments, arg);
        }
    });
    

    …or you can make slightly larger changes and get the benefit of a speed increase (callSuper uses arguments.callee, which is slow), properly-named functions (for debugging and such), and truly private functions:

    var SuperThingy = Helper.makeClass(function() {
        function SuperThingy_foo(arg) {
            console.log("SuperThingy: " + arg);
            trulyPrivate.call(this);
        }
    
        function trulyPrivate() {
            console.log("I'm truly private.");
        }
    
        return {foo: SuperThingy_foo};
    });
    var Thingy = Helper.makeClass(SuperThingy, function() {
        function Thingy_foo(arg) {
            console.log("Thingy: " + arg);
            foo.$super.call(this, arg);
        }
    
        return {foo: Thingy_foo};
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a set of classes that were created by www.sudzc.com (awesome WDSL web
If have a set of classes that all implement an interface. interface IMyinterface<T> {
I'm using ASP.NET MVC RC2. I have a set of classes that were auto-generated
I have a set of callback classes that I use for handling callbacks with
I have a set of some classes which are all capable of being constructored
I have written a set of classes and interfaces that are implemented in Moose
I have a set of core, complicated JavaScript data structures/classes that I'd like to
I have been assigned a project to develop a set of classes that act
Hi experts i have created a set of UItableviewcustom cell classes. Now can i
I have a set of classes class myClassA{ friend class MyFatherClass; }; class MyFatherClass{

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.