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 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: Victor Porton Newsgroups: comp.lang.ada Subject: Re: Subtype or derived type? Date: Sat, 07 Oct 2017 19:23:29 +0300 Organization: Aioe.org NNTP Server Message-ID: References: NNTP-Posting-Host: 9OC/PY8QRnnqnNGuo4rrrw.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Complaints-To: abuse@aioe.org User-Agent: KNode/4.14.10 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:48390 Date: 2017-10-07T19:23:29+03:00 List-Id: Victor Porton wrote: > While developing (thick object oriented) bindings for a C library: > > I have developed a package containing Term_Type type with bindings > for raptor_term type: > https://github.com/vporton/redland-bindings/blob/ada2012/ada/src/rdf-raptor-term.ads > > Term_Type represents pointer C type raptor_term* (where raptor_term > is a struct). > > Now I am developed bindings for librdf_node which is defined as: > > typedef raptor_term librdf_node; > > Now I ask advice how to define the type representing librdf_node* > pointer type. > > I have two variants in mind: > > 1. > > subtype Node_Type is Term_Type; > > 2. > > type Node_Type is new Term_Type; > > Please advise which of the two is better. I am declined to use a derived type, because I may naturally have subprograms with the same name (as the name is derived from the name of the corresponding C function) and then using subtype, when I "use" both modules, the names would clash. But I am not sure. -- Victor Porton - http://portonvictor.org