-- Regards, Bob _____ From: blackbox{([at]})nowhere.xySent: 15 June 2007 03:35 To: BlackBox Mailing List Subject: [BlackBox] - Hiding abstract methods Bob, I am trying to keep the amount of stuff shown to a minimum. There is also a procedure Run that is exported from M that when called starts up and eventually calls the installed reader and writer (repeatedly). The reader and writer do not invoke the hidden procedures they are passive and are called by M when needed. How do I hide the methods of A, Bits, and Ints? -Doug Danforth Bob Walkden wrote: How and when are M's internal procedures invoked? If the client's reader is to invoke them directly then they must be made public. If you want M's hidden procedures to be invoked indirectly by the reader or writer you may need to provide a couple of Notifier procedures in M and have the reader or writer call them explicitly. -- Regards, Bob _____ From: blackbox{([at]})nowhere.xySent: 14 June 2007 22:25 To: BlackBox Mailing List Subject: [BlackBox] - Hiding abstract methods Chris, Here is what I would like the interface to module M to appear DEFINITION M; TYPE A = POINTER TO ABSTRACT RECORD END; Bits = POINTER TO RECORD (A) x: POINTER TO ARRAY OF SET END; Ints = POINTER TO RECORD (A) x: POINTER TO ARRAY OF INTEGER END; Reader = PROCEDURE (VAR a: A): BOOLEAN; Writer = PROCEDURE (a: A); PROCEDURE InstallReader (rd: Reader); PROCEDURE InstallWriter (wr: Writer); END M. One just installs a specific reader that generates a Bits or an Ints. Internally to M there are many procedures that take the abstract quantity 'a' when a read operation is done and operate on it with procedures that are methods of type either Bits or Ints whose definitions are given internally and are abstractions of the of type A. But the user of M need not know anything about this and BlackBox should not force the user to see these methods. How can this be accomplished? -Doug Danforth CFB Software wrote: Hi Doug, I don't know if I can help but as nobody else has responded yet I'm willing to give it a try. I'm interested in learning more about the finer details of issues like this. However, I'm not sure from your desription that I understand exactly what you are trying to do. Would it be possible for you to show complete minimal examples of: a) What you would like the code to look like b) How you think it needs to be written to make it acceptable to Blackbox Regards, Chris Burrows CFB Software http://www.cfbsoftware.com/gpcp -----Original Message----- From: blackbox{([at]})nowhere.xyBehalf Of Douglas G. Danforth Sent: Wednesday, 13 June 2007 10:22 AM To: BlackBox Mailing List Subject: [BlackBox] - Hiding abstract methods Folks, I have a conceptual problem on which I would like your advice. I have an ABSTRACT type A and two concrete types C1 and C2 which are extensions of A. TYPE A* = POINTER TO ABSTRACT RECORD END; C1* = POINTER TO RECORD(A) END; C2* = POINTER TO RECORD(A) END; I would like to export A (as shown with the '*'') but within the module M where A is defined I *do not want* to export its methods. I want them to be completely hidden so that the user of M only needs to create the instance Ci (and fill its fields (not shown)) and pass Ci to the module M in which the specific methods appropriate to Ci are specified (but also not exported). Within M, procedures take 'a' (an instance of A which is either C1 or C2) and operates on it without knowledge of its concrete form. The methods of A are simply called and the concrete forms of those methods as C1 or C2 are actually run. Unfortunately, it seems that this scheme of things is not possible in BlackBox. I am forced to export the methods of A and also the methods of C1 and the methods of C2, greatly cluttering the interface to M when none of that information will be used by the person operating with M. Only the existence of A and the extensions C1 and C2 are needed. Is there a clean way to hide all of these methods? -Doug Danforth --- BlackBox --- send subject HELP or UNSUBSCRIBE to blackbox{([at]})nowhere.xy --- BlackBox --- send subject HELP or UNSUBSCRIBE to blackbox{([at]})nowhere.xy
This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:31:32 UTC