From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,5e1ecbc6afec137d X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news4.google.com!news.glorb.com!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!newsfeed00.sul.t-online.de!t-online.de!tiscali!newsfeed1.ip.tiscali.net!proxad.net!news.in2p3.fr!in2p3.fr!oleane.net!oleane!hunter.axlog.fr!nobody From: Jean-Pierre Rosen Newsgroups: comp.lang.ada Subject: Re: prefix notation Date: Mon, 12 Mar 2007 13:27:57 +0100 Organization: Adalog Message-ID: References: NNTP-Posting-Host: mailhost.axlog.fr Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Trace: s1.news.oleane.net 1173704470 2009 195.25.228.57 (12 Mar 2007 13:01:10 GMT) X-Complaints-To: abuse@oleane.net NNTP-Posting-Date: Mon, 12 Mar 2007 13:01:10 +0000 (UTC) User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) In-Reply-To: Xref: g2news1.google.com comp.lang.ada:14473 Date: 2007-03-12T13:27:57+01:00 List-Id: Ali Bendriss a �crit : > To be able to use the prefix notation I understand that each operation on an > object must be in the same package of the object himself. Like in other OO languages, where you can apply the prefix notation only to member functions. > What about if I have a big number of operation and I would like the user to > write something like > > procedure test is > Img : Image_Obj; > begin > Img.Read ("test.tiff"); Img.Rotate(90); Img.Draw(Circle);....; > Img.SetPixel ((100,72), Red)); > Img.Write ("test.gif"); > end test; > > Is there some way to split the package to still have something readable > (notably the specification) ? > What other facility may I use for that purpose. > I would suggest to make a clear distinction between "methods" and "operations". A method is something where it makes sense for each object to implement it in a different way: for example, a square will not implement "draw" the same way as a circle will. An operation is a subprogram that operates on an object, but where the implementation is the same for every kind of object. "Move" is always equivalent to Erase-Set_X_Y-Draw. This is not a method, since it should not depend on which kind of objects it operates on. I don't know exactly what you are trying to achieve, but is Read a property of Img? To me, it looks like a property of a Tiff object. The method depends on the format of the file, not on the object being read. Similarly, isn't Draw a method of Circle rather than Img? etc. There is no general rule, but often if you end up with too many methods, it may well be that they don't belong to the right object. (BTW: the whole Java library is full of these badly assigned methods!) My 5cts... -- --------------------------------------------------------- J-P. Rosen (rosen@adalog.fr) Visit Adalog's web site at http://www.adalog.fr