Rob Speer on 4 Apr 2003 23:55:01 -0000 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: [spoon-discuss] About Glotmorf's OO rule |
On Fri, Apr 04, 2003 at 03:51:47PM -0500, Daniel Lepage wrote: > I would have called Point Properties 'Reference Properties' instead, > but the idea is still good. If, for example, proposals needed to know > who made them, they'd have to have a pointer/reference to the correct > player - if we just used Objects, then each proposal would create its > own copy of its author... which would certainly be interesting... Okay. So, I've been expanding out my classes, and one very basic class is the Value, which so far is a Number, a String, or Text (and we handle Strings and Text differently enough that they shouldn't inherit from each other). Now that you point that out, another necessary type of value is a Reference. > This doesn't seem to specify how Class properties and Instance > properties differ either... Right, bad phrasing. "Has all of the properties _listed in_ its class". > And not all derived objects can perform all of the actions of their > Class and those of all Superclasses of their Class. Case and point the > spoo-fleem issue I mentioned, where the derived class would only have > the bar() method of one of its parents. Revised in the newer version. I was hoping not to need these, but there's another OO concept called the Mixin (named after, of course, the famed Russian computer scientist Anatoly Mixin <G>). I don't know if I'm using the term correctly here, but what I want a Mixin to be is something that gives properties to instances of the class that it is mixed into, but _not_ to instances of subclasses. The reason for this is that instances of Person need to be Automatic - the Gamestate can't affect the fact that, say, Bill Gates is a Person, shouldn't keep track of that fact, and cannot in fact destroy his instance - but instances of Player are not Automatic. I'm also taking out Actions, since the ability to perform an action is just a property, and putting in Variables explicitly. But note that I'm not overusing Variables. Only things that actually vary are variables; a sequence's length is not a variable, it's a definition, because the instance of Sequence (1, 2, 3) is always going to have length 3 no matter what you do to it. Here's what I have now: Class: Thingy Inherits from: None Properties: * follows the Rules * is an instance of a Class * has all of the properties listed in its Class, all Superclasses of its Class, and all its Mixins, except in these cases: = If two properties contradict: - if both properties come from Mixins, the Mixin listed earlier takes precedence - if one property comes from a Class and the other from a Mixin, the Mixin takes precedence - if both properties come from the same class, the one that is later in the Properties list takes precedence - if the class that creates one property is a superclass of the class that creates the other, the subclass takes precedence - Take the highest Superclass of the Class that inherits from the two classes with contradictory properties - the property from the class which comes earlier in the Superclass's inheriting list takes precedence. = If three or more properties are mutually contradictory, the Thingy does not have any of the properties = If a property contradicts a rule, the rule takes precedence * has 0 or more variables set to certain values, which are inherited from the Class and all its Superclasses the same way as properties, and if a variable with the same name is assigned more than once, it is considered a conflict and handled as above. [[This is the messiest part. If you can help me clarify the wording, great. Also, because of the possibility of overriding the rule-10-equivalent up above, there should be this rule: "If any Thingy does not have at least the properties of the Thingy class, it is not considered a part of the game."]] Class: Concept Inherits from: Thingy Properties: * every possible Instance that has the appropriate properties already exists Class: Value Inherits from: Concept Class: Number Inherits from: Value Properties: * is a mathematical constant [... Integer, NaturalNumber, PositiveNumber classes derive from it] Class: List Inherits from: Concept Properties: * has any number of members, each of which is an Instance Class: Set Inherits from: List Properties: * all members are distinct Class: Sequence Inherits from: List Properties: * defines its Length (an instance of Integer), equal to its number of members * every member is associated with an Index (an instance of Natural) * the Indices form a consecutive sequence of numbers, starting with 0 Class: String Inherits from: Value Properties: * is a sequence of alphanumeric characters Class: Text Inherits from: Value [[not String]] Properties: * is written text, where whitespace and formatting are not relevant Class: Name Inherits from: String Properties: * has a Length which is from 1 to 255, inclusive * contains only whitespace, alphanumeric, and punctuation characters * can be used to identify an object iff any of these is true: - the name is required to be unique - the object's Type is specified, and the name is unique within that Type - the object can be inferred from context with no ambiguity Class: Variable Inherits from: Value Properties: * has a Name, a Value, and a Type that the Value must be Class: Type Inherits from: Value Properties: * is associated uniquely with a Class * has the same name as its associated Class * An object is considered to be of this Type if the named Class is that object's Class or a Superclass of that Class. * "is a Foo" can be used to mean that an object is of this type, where 'Foo' is replaced by this type's name, and 'a' is perhaps replaced by 'an'. Class: Reference Inherits from: Value Properties: * is any way of uniquely identifying an Object * has a Target, which is the Object it identifies [[I was thinking of having a Reference point to a Thingy instead of an Object, but I don't expect we'll actually need a reference to the number 5 or the word "fish" or Dave's left sock.]] Class: Action Inherits from: Concept Properties: * (properties of Actions go here) Class: Object Inherits from: Thingy Properties: * has a name * its existence is tracked by the Administrator * is part of the Gamestate Class: Class Inherits from: Object Properties: * inherits from one or more classes, unless it is named Thingy * has a list of Superclasses, which contains each Class that it inherits from, plus all the Superclasses of each of those Classes * has a list of Properties and a list of Variables (each of which may be empty) * each of its Variables has a default value, which is the value of that variable for newly-created Instances Class: Mixin Inherits from: Object Properties: * has a list of Properties, which are inherited by instances of any Class that uses that Mixin, but are not necessarily inherited by Subclasses of that Class Class: Unique Inherits from: Object Properties: * is the only instance of its class * cannot be destroyed * has a uniquely-identifying name Class: Rule Inherits from: Object Properties: * (properties of rules go here) Class: Ruleset Inherits from: Unique, Container Properties: * contains all Rules in existence, plus the ClassList Class: ClassList Inherits from: Unique, Container Properties: * contains the definitions of all Classes Class: BNomic Inherits from: Unique, Container Properties: * contains all Thingies * is named "B Nomic" * may also be referred to as "The Game" * its motto is "B Nomic: It's better than sex." Mixin: Automatic Properties: * is not a part of the Gamestate * does not need to be explicitly created * does not override any Properties of its Superclasses * cannot be destroyed Class: ForumPost Inherits from: Object Mixins: Automatic Properties: * is read by the Administrator * if it is posted by a Player, contains Actions to be taken by that Player Class: Entity Inherits from: Object Class: Person Inherits from: Entity Mixins: Automatic Properties: * passes the Turing Test Class: Player Inherits from: Person Class: Administrator Inherits from: Person -- Rob Speer _______________________________________________ spoon-discuss mailing list spoon-discuss@xxxxxxxxx http://lists.ellipsis.cx/mailman/listinfo/spoon-discuss