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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.129.177.133 with SMTP id p127mr19385927ywh.61.1483450787249; Tue, 03 Jan 2017 05:39:47 -0800 (PST) X-Received: by 10.157.39.129 with SMTP id c1mr2816791otb.15.1483450787206; Tue, 03 Jan 2017 05:39:47 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!p16no3569509qta.1!news-out.google.com!u18ni10221ita.0!nntp.google.com!75no5960927ite.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 3 Jan 2017 05:39:46 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=194.154.216.95; posting-account=sDyr7QoAAAA7hiaifqt-gaKY2K7OZ8RQ NNTP-Posting-Host: 194.154.216.95 References: <29380aa7-0c3b-4908-94c6-aa91f3996b42@googlegroups.com> <1c754dc2-01fc-455a-bd9a-01ecb71591af@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <9f6b6a5a-2f0b-4fbd-8171-36199caa6e49@googlegroups.com> Subject: Re: Experimenting with the OOP features in Ada From: Laurent Injection-Date: Tue, 03 Jan 2017 13:39:47 +0000 Content-Type: text/plain; charset=UTF-8 X-Received-Bytes: 3571 X-Received-Body-CRC: 2013967268 Xref: news.eternal-september.org comp.lang.ada:33018 Date: 2017-01-03T05:39:46-08:00 List-Id: On Monday, 2 January 2017 21:55:49 UTC+1, Dmitry A. Kazakov wrote: > Your Create function creates a whole object. > Ok my fault. Transformed the into procedures and changed the name. > > I am quite tempted in using the persistent storage capabilities of > > Simple Components but that means that I have to adapt my program to the > > style of this library. Don't think that it would be possible to only graft > > it > > at the latest moment? > > > > It is not style, but a plain conceptual error. You are using a > constructing function as if it were a setter. That won't work anywhere > in any language. > Wasn't what I tried to say. In the docs about persistent objects you write: "Like other objects, persistent ones are normally accessed through handles." The old version of my program doesn't contain handles. No access values or whatever. So I have actually to rewrite it completely from the beginning and adapt it to Simple Components. > > BTW what is the reach of the overriding keyword i.e.: > > > > The keyword hints the compiler that the subprogram overrides the > parent's implementation. If you make a mistake in the parameter profile, > the compiler will reject the program. It adds a lot of safety. If not > keeping it Ada 95 compatible, always use "overriding" and "not > overriding" when declaring operations on tagged types. It is a good style. > > But I have to put it for every function/procedure. It won't work if I just put it at the first possible place and expect that the compiler will automagically figure out where to apply it. > > Gnat was only complaining that Create_Name needs overriding even if > > Create_Code_SIL is also in the Base_Type which is abstract. > > > > This a different story. Here the compiler complains that you forgot to > override an operation that must be overridden. Overriding is required > for abstract operations and operations returning new objects. In the > first case there is no implementation to inherit from. In the second > case the implementation would be most likely garbage. > > After changing the functions to procedures gnat complains that Set_Code_SIL doesn't override. Before the change it didn't even it should have done so? > -- > Regards, > Dmitry A. Kazakov > http://www.dmitry-kazakov.de > Thanks