I can see how someone coming from a language like Java would feel at home with "one class per class file" (my understanding is that it's good practice to only have one per file in Java, even if the language supports otherwise.)
Perhaps it's because I use Python pretty heavily, but intuitively, I thought of TCFs as being "modules". TeraScribe's ability to create multiple classes in a single file further strengthened my reason to believe that, hence my confusion at the error. I personally like having the option to have multiple classes in a single file. Sometimes, your classes all serve as individual components to a cohesive set. Separate enough to warrant separate classes, together enough to warrant being packaged in the same thing. It would definitely be a feature I personally would use, and it does not get in the way of people who prefer to have one class per file, so if you were to ask me, I would say to complete the feature. Thanks, Robert. -Ian On 01/13/2015 04:54 PM, Robert Shubert wrote: > Ian, > > Actually, it's an incomplete feature. > > The story is that the ability to define multiple classes in one TCF was > designed into the original TCF definition. This work was done mostly by > Pervasive back in the last 90s. However the feature was never brought out in > the Tango2000/Witango Development Studio, which was restricted to only a > single class per TCF. > > Fast forward to 2006 and work done on the rewritten Witango Development > Studio/TeraScribe allows for multiple classes to be defined. > > However, the work in the server was not complete when I took on development. > I believe that the Create Object Action can access the second class, but > @CREATEOBJECT cannot. I've actually known about this shortcoming all along. > Why haven't I fixed it? Well the simple answer is that I haven't decided if > enforcing the "one class per file" rule is something the platform should do. > The GUI of TeraScribe provides a reasonable mechanism to manage multiple > classes per file - by creating a cache of all classes, regardless of file and > presenting those classes in a clean way. But TeraScribe isn’t that advanced, > and the standard reasons for "one class per file" remain. See here: > http://stackoverflow.com/questions/469887/how-many-classes-should-a-programmer-put-in-one-file > > And so, the feature has neither been completed nor removed. > > I suggest that you limit your TCFs to only one class for now. > > Robert > > PS. I'd enjoy hearing your thoughts on this topic as it's one I've considered > for years and have had very little input on. > > > -----Original Message----- > From: Ian Evans [mailto:[email protected]] > Sent: Tuesday, January 13, 2015 5:30 PM > To: [email protected] > Subject: TeraScript-Talk: multiple classes in a single tcf > > Hello again, > > When creating a TCF in TeraScribe, it's possible to define multiple object > classes and their methods. Instantiating separate objects in a TAF from the > classes defined in the TCF works just fine. > > However, say you have a TCF with Class1 and Class2. Class1 was the first > class defined in the TCF, and Class2 was the second class defined. Each has a > method that just returns some text in returnValue, nothing complex. > > Your TAF file instantiates each class (the order they are instantiated > doesn't matter.) Calling a method from Class1 works just fine. Calling a > method from Class2 causes TeraScript to throw a -806 error ("unspecified > method call") > > Changing the TAF file to only instantiate Class2 and call its method yields > the exact same results. > > Am I just not understanding how classes are supposed to operate, or is this a > bug? > > Thanks, > -Ian > > > > ---------------------------------------- > > To unsubscribe from this list, please send an email to > [email protected] with "unsubscribe terascript-talk" in the body. > > > > > ---------------------------------------- > > To unsubscribe from this list, please send an email to > [email protected] with "unsubscribe terascript-talk" in the body. > > ---------------------------------------- To unsubscribe from this list, please send an email to [email protected] with "unsubscribe terascript-talk" in the body.
