[exprla-devel] Re: [XPL] The structure of classes in XPL
Status: Pre-Alpha
Brought to you by:
xpl2
From: reid_spencer <ras...@re...> - 2002-01-31 08:59:54
|
--- In xpl-dev@y..., cagle@o... wrote: There's a few differences I've encountered between object definitions in XML and the same definitions in a language like Java that might make overloading problematic. The first is that an XML Schema definition is more like a VB type statement than a Java class -- the schema defines the type and positional characteristics of an XML structure, but not any associated methods or events. However, you could make a superclass structure that might actually include a schema and an associated stylesheet with named templates, with templates acting as methods. Keep in mind that the one primary difference between XML and procedural objects is that the XML instance of a schema may not necessarily be physically connected with the methods that operate on it. We should thus ask whether XPL works by keeping the XML instance data of a class as part of the object -- i.e., the XML acts as the local variables -- or the XML data arrives as input and is processed in real time against the XPL/XSLT templates (in which case the XPL objects are methods only). The former is a statist approach -- the data needs to be retained between calls, while the latter is stateless. As to the question of object polymorphism, it would probably be a safe assumption to say that an object is something that has a base level schema definition. XML Schema has a polymorphism mechanism that may be applicable here -- you could create a virtual schema for a human, then create another schema that inherits off the human schema for an occupational schema. Note also that in the sample, you are confusing data and structure. Rather than: <me> <human> <name>Alexander Gutman</name> <birthdate>01.07.1966</birthdate> </human> <mathematician> <name>Alex Goodman</name> <workplace>Blahblah Institute</workplace> </mathematician> <programmer> <name>Alex Softman</name> <workplace>FoobarSoft</workplace> </programmer> </me> your structure could be changed to recognize that both mathematician and programmer are both occupations: <me> <human> <name>Alexander Gutman</name> <birthdate>1996-07-01</birthdate> <occupation> <title>mathematician</title> <workplace>BlahBlah Institute</workplace> <alias>Alex Goodman</alias> </occupation> <occupation> <title>programmer</title> <workplace>Foobar Software</workplace> <alias>Alex Softman</alias> </occupation> </human> </me> -- Kurt Cagle ----- Original Message ----- From: Richard Anthony Hein To: xpl@e... Sent: Sunday, June 11, 2000 10:51 AM Subject: RE: [XPL] The structure of classes in XPL Could a form of overloading address this problem? Like in a Java class, there may be multiple functions in the class that do different things depending on the type of parameter (one may be a string, another may be an integer), but the overall function result is the same. So if you use overloading, you call <human>, <mathematician>, and <programmer> as if they were different functions in the class? Richard A. Hein -----Original Message----- From: Alexander E. Gutman [mailto:gutman@m...] Sent: June 11, 2000 10:15 AM To: xpl@e... Subject: [XPL] The structure of classes in XPL At this moment, I am thinking about how classes will be declared in XPL. And I encountered a problem. As soon as XPL is closely related to XML, the structure of its classes should be as flexible as XML structures. Should we regard classes as XML element types (and, probably, declare them via schema element type definitions) or should we employ a standard approach of some kind? Consider me as an example of an XPL object. First of all, I am a human. As a human, I have a name (Alexander Gutman) and birthdate (01.07.1966). On the other hand, I am a mathematician. As a mathematician, I have a name (Alex Goodman) and workplace (Blahblah Institute). Furthermore, I am also a programmer. As a programmer, I have a name (Alex Softman) and workplace (FoobarSoft). In XML, the above information can be easily structured, for instance, as follows: <me> <human> <name>Alexander Gutman</name> <birthdate>01.07.1966</birthdate> </human> <mathematician> <name>Alex Goodman</name> <workplace>Blahblah Institute</workplace> </mathematician> <programmer> <name>Alex Softman</name> <workplace>FoobarSoft</workplace> </programmer> </me> The question is: How such a structure can be modeled via "usual" classes? Of course, there are many different solutions, but I wonder if there is a solution close (in flexibility) to that of XML. (You may use any concepts, including multiple inheritance.) -- Alexander E. Gutman ---------------------------------------------------------------------- ------ ---------------------------------------------------------------------- ------ To unsubscribe from this group, send an email to: xpl-unsubscribe@o... ---------------------------------------------------------------------- -------- ---------------------------------------------------------------------- -------- To unsubscribe from this group, send an email to: xpl-unsubscribe@o... --- End forwarded message --- |