A page for discussion of Object Orientation in Tcl. Whether it's good, why it's good (if it is), how one might go about using Tcl in an OO manner. What support is there in the core for it, and what support should be added to the core (if any), and why.
IL - I'd like to add that this page would be helpful to discuss from the point of view of If TCL had an OO system, how would it work?
SysTems - Okay, here are my not yet very mature toughts on OO Yesterday I was reading Peter Chen paper (was writen in the 70th) about the ERD or ERM or ERDM how ever you want to call it
ERD -> Entity Relationship Diagram; ERM -> Entity Relationship Model; ERDM -> Entity Relationship Diagram Model
He was talking about a unify view for data model from which you can derive data model that support the three other data models at that time:
1-The network model; 2-The relational model; 3-the sets (or entity sets) models
I know a little about the first two model, but really have no clue about the first
Anyway, what Interested me in the paper is how he separeted an Entities (object) from entity sets (class) from attributes, from values and value set
The concept is still blury in my head, but, I like how he tought of attributes he define attributes as functions that map an entity to a value from a value set
So it's like a hask table, in which you can register a value that belongs to a certain value set
A pop up question, can you define a value set in Tcl? (my first tought was yea, regexp specially since everything was a string)
Anyway another interesting thing to not, is thinking of object this way, an object is just a grouping of values with special semantics, meaning, you can define two objects, Dog and Cat, both have a name attribute and an age attribute (within possibly the same set of values, ie, less then a certain age (which is itself a special kind of numbers, or itself a grouping of 3 value a value for years (age years more then 0 less then x) a value for months (more then 0 less then 12) etc)
What breaks my head is this recursive nature, a value is itself a grouping of other values each belong to a certain set of values themselve a grouping of values etc....
But anyway, we can say we need to be able to define
1-A grouping or a structure; 2-A constrainted set of value for the structure
Ocaml already does that, I think
A popup question if a funtion operates on a set of values (for an object), do we need to know if this value is the whole object or a piece of it
For example, if a function (or object that respond to messages) operates on FirstName set of Value, should we always send it the Firstname piece explicitly, or should we send it the object the object and let it investigate, honeslty I think this depends on how you code you application, and not necessarely a language feature.
I feel, I am running in circles now ... but I wanted to express my toughts on the issue anyway :)
Some languages defines, sets of value, that I might call em atomic, you can not decompose them, break em into piece, but you can produce a limited set of them
A popup question, in Tcl everything is a string, what kind of string (unicode string, or ascii or what, unicodes represent a larger set)?
The point is, the charactere is our atomic unit here in Tcl, you can not decompose a character, but via regexp you limit it's possible set of value, and via encoding and structures you can define groupings
Encoding: (for example a list is a structure define by encoding, the space value is a seprator, a list is a particular type of grouping, in which the piece have an order or a rank not a name, so it's a structure define by it's encoding)
structures: (Namespace, ensembles, itcl classes, xotcl classes, etc...)
Inheritance and such, I think are just a conveniant way to extend the structures, and possible extend their semantics
I almost forget to mention this, A cat and Dog can be define as indentical structures, yet on the semantic level they are different, but then it's because the word cat and dog means a lot of different things to us human, those different things were not defined in the structure, but in the structure name
Another Example, FirstName, NickName ... can possible register values for their objects within the same set of value (character values) yet, they mean totally different things to us
This semantic, usually will reflect into where in the program flow those two attributes will be required from an object
So, what is the best way to group sets of values and sets of attributes under semantically different names, using Tcl? and what conveniant features such as inheritence (also possibly a semantic feature) would you like to have?