comp.lang.ada
 help / color / mirror / Atom feed
From: "DuckE" <nospam_steved94@home.com>
Subject: Re: Using renaming declarations to make private subprograms visib le
Date: Wed, 29 Aug 2001 04:18:33 GMT
Date: 2001-08-29T04:18:33+00:00	[thread overview]
Message-ID: <t2_i7.15069$MK5.10047245@news1.sttln1.wa.home.com> (raw)
In-Reply-To: 878zg3vma6.fsf@chiark.greenend.org.uk

Do you have a problem with creating a body for the package to do the
conversion?

with Ada.Strings.Unbounded;

package tokens is

  type Token_Type is private;

  function To_Token(Source: String) return Token_Type;
  pragma Inline( To_Token );

private
  type Token_Type is new Ada.Strings.Unbounded.Unbounded_String;
end;

package body tokens is

   function To_Token (Source: String) return Token_Type is
   begin
      return Token_Type(
Ada.Strings.Unbounded.To_Unbounded_String(Source) );
   end To_Token;

end tokens;

It may be a little verbose, but should work just fine (I didn't run it to
verify, but it compiles).

SteveD

"Matthew Woodcraft" <mattheww@chiark.greenend.org.uk> wrote in message
news:878zg3vma6.fsf@chiark.greenend.org.uk...
> "Beard, Frank" <beardf@spawar.navy.mil> writes:
>
> > Matthew,
> >
> > Have you tried fully qualified names, such as:
> >
> > private
> >
> >    type Token_Type is new Ada.Strings.Unbounded.Unbounded_String;
> >
> >    function To_Token (Source : String) return Token_Type
> >      renames Ada.Strings.Unbounded.To_Unbounded_String;
> >
> >    function To_String (Source : Token_Type) return String
> >      renames Ada.Strings.Unbounded.To_String;
>
> But Ada.String.Unbounded.To_String is a function which return an
> Ada.Strings.Unbounded.Unbounded_String. The function which I want to
> make visible is its implicitly-defined cousin, which returns a Token.
>
> -M-
>





  reply	other threads:[~2001-08-29  4:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-28 20:19 Using renaming declarations to make private subprograms visib le Beard, Frank
2001-08-28 22:42 ` Matthew Woodcraft
2001-08-29  4:18   ` DuckE [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-08-29 17:26 Beard, Frank
replies disabled

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