comp.lang.ada
 help / color / mirror / Atom feed
From: Victor Porton <porton@narod.ru>
Subject: Re: Subtype or derived type?
Date: Sat, 07 Oct 2017 19:23:29 +0300
Date: 2017-10-07T19:23:29+03:00	[thread overview]
Message-ID: <orav2a$a89$1@gioia.aioe.org> (raw)
In-Reply-To: orauq5$9tv$1@gioia.aioe.org

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

  reply	other threads:[~2017-10-07 16:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-07 16:19 Subtype or derived type? Victor Porton
2017-10-07 16:23 ` Victor Porton [this message]
2017-10-07 16:24   ` Victor Porton
2017-10-09 21:50 ` Randy Brukardt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox