From dev-return-53666-apmail-cocoon-dev-archive=cocoon.apache.org@cocoon.apache.org Mon Jan 05 15:37:12 2004 Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 99955 invoked from network); 5 Jan 2004 15:37:11 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 5 Jan 2004 15:37:11 -0000 Received: (qmail 14992 invoked by uid 500); 5 Jan 2004 15:36:59 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 14959 invoked by uid 500); 5 Jan 2004 15:36:59 -0000 Mailing-List: contact dev-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: dev@cocoon.apache.org Delivered-To: mailing list dev@cocoon.apache.org Received: (qmail 14901 invoked from network); 5 Jan 2004 15:36:58 -0000 Received: from unknown (HELO web41901.mail.yahoo.com) (66.218.93.152) by daedalus.apache.org with SMTP; 5 Jan 2004 15:36:58 -0000 Message-ID: <20040105153659.52264.qmail@web41901.mail.yahoo.com> Received: from [65.116.199.19] by web41901.mail.yahoo.com via HTTP; Mon, 05 Jan 2004 07:36:59 PST Date: Mon, 5 Jan 2004 07:36:59 -0800 (PST) From: Tim Larson Subject: [cforms] Forwarding: Explanation of derived classes To: dev@cocoon.apache.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N [Forwarding email from discussion with Marc.] --- Marc Portier wrote: > I saw a different mail for that, no? Here are a couple emails: http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=107090293001052&w=2 http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=106953358228020&w=2 Summary: We may want to parameterize "class" to allow it to define (or "new" to allow it to create) modified versions of a class, such as to give nested unions a different default case than their parents, or to add or remove widgets in nested widget structures. Let me see if I can describe this more clearly. In Java you can define a class that extends another class to allow for additional, modified, or restricted behavior. This is the main concept I am referring to when I mention derived classes. I would like to be able to create a class of widgets, and then be able to define additional classes which extend the first class. What may be throwing you is that I am mixing in an idea that is not from Java. Some languages allow "classes" to be specified by example, rather than requiring a separate class definition. Think of it like being able to take an object *instance* and say: Object newObject = new oldObject(); to create a new object with the same variables and methods as the oldObject instance. Now add Java's concept of anonymous classes to allow you to say: Object extendingObject = new extendedObject() { // Place extending variables and methods here } To bring this back to the cforms context, look at NewJXPathBinding to see how it can create an "instance" (remember: really just an object reference) of either a defined "class" or of another active binding. This is like the first example above, "new oldObject()". In general, I want to be able to take a "class" or an example binding, definition, or template and be able to "extend" it either while defining a new "class" or while creating an instance with "new". This last case, creating an extending object using "new", is like the second example above, "new extendedObject() { }". You are probably thinking, "What's this for?" Classes are good if you want to create more than one instance, or if you need to specify the definition (e.g. for interfacing reasons) separate from creating the instance data. When your use case does not have either of these requirements, being forced to define a class is syntactic overhead, slowing you down and cluttering your code. Similarly, if you will never need to reference a class's name except to create the only instance of the class, then having support for anonymous classes can cut the overhead of having to create and maintain a non-conflicting name for the class. Is this explanation clearer, or is you head spinning now? > >>>>- thinking also about proposing define/use in stead of class/new We could do this name change, but what do you think in light of the explanation given above? --Tim Larson __________________________________ Do you Yahoo!? Find out what made the Top Yahoo! Searches of 2003 http://search.yahoo.com/top2003