comp.lang.ada
 help / color / mirror / Atom feed
* No "pragma Deprecated (NAME)"?
@ 2010-01-21  3:47 Michael R
  2010-01-21  3:57 ` Jeffrey R. Carter
  0 siblings, 1 reply; 4+ messages in thread
From: Michael R @ 2010-01-21  3:47 UTC (permalink / raw)


Hi folks,

I was re-organizing some code and wanted to change some procedure/
function names, e.g.,

    function To_String (T : My_Type) return String;

becomes

   function Name (T : My_Type) return String;

Without consulting the docs, I tried

   function Name (T : My_Type) return String;
   function To_String (T : My_Type) return String
      renames Name;
   pragma Deprecated (To_String);

I guess I'm too used to annotating methods in Java and was surprised I
couldn't do this in Ada.

The only way to do this is to simply rename and fix the compilation
errors which is may be in the Ada style: just get it right.

Take care,
Michael.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: No "pragma Deprecated (NAME)"?
  2010-01-21  3:47 No "pragma Deprecated (NAME)"? Michael R
@ 2010-01-21  3:57 ` Jeffrey R. Carter
  2010-01-21  4:00   ` Michael R
  0 siblings, 1 reply; 4+ messages in thread
From: Jeffrey R. Carter @ 2010-01-21  3:57 UTC (permalink / raw)


Michael R wrote:
> 
>    function Name (T : My_Type) return String;
>    function To_String (T : My_Type) return String
>       renames Name;
>    pragma Deprecated (To_String);

"Deprecated" is not a language-defined pragma, but unrecognized pragmas should 
be ignored (ARM 2.8). I see nothing wrong with your function renaming. What 
error message did you get?

-- 
Jeff Carter
"Every sperm is sacred."
Monty Python's the Meaning of Life
55



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: No "pragma Deprecated (NAME)"?
  2010-01-21  3:57 ` Jeffrey R. Carter
@ 2010-01-21  4:00   ` Michael R
  2010-01-21  9:30     ` Ludovic Brenta
  0 siblings, 1 reply; 4+ messages in thread
From: Michael R @ 2010-01-21  4:00 UTC (permalink / raw)


On Jan 20, 7:57 pm, "Jeffrey R. Carter"
<spam.jrcarter....@spam.acm.org> wrote:
> Michael R wrote:
>
> >    function Name (T : My_Type) return String;
> >    function To_String (T : My_Type) return String
> >       renames Name;
> >    pragma Deprecated (To_String);
>
> "Deprecated" is not a language-defined pragma, but unrecognized pragmas should
> be ignored (ARM 2.8). I see nothing wrong with your function renaming. What
> error message did you get?
>
> --
> Jeff Carter
> "Every sperm is sacred."
> Monty Python's the Meaning of Life
> 55

Hi,

Yes, it generated a warning as un-recognized but I was hoping for the
functionality, i.e., the
implementation of this pragma where usage of the old name generates
deprecated warning when
used.

Take care,
Michael.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: No "pragma Deprecated (NAME)"?
  2010-01-21  4:00   ` Michael R
@ 2010-01-21  9:30     ` Ludovic Brenta
  0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Brenta @ 2010-01-21  9:30 UTC (permalink / raw)


Michael R wrote on comp.lang.ada:
> On Jan 20, 7:57 pm, "Jeffrey R. Carter"
>>>    function Name (T : My_Type) return String;
>>>    function To_String (T : My_Type) return String
>>>       renames Name;
>>>    pragma Deprecated (To_String);
>
>> "Deprecated" is not a language-defined pragma, but unrecognized pragmas should
>> be ignored (ARM 2.8). I see nothing wrong with your function renaming. What
>> error message did you get?
>
> Yes, it generated a warning as un-recognized but I was hoping for the
> functionality, i.e., the implementation of this pragma where usage
> of the old name generates deprecated warning when used.

GNAT has an implementation-defined "pragma Obsolescent", see

http://gcc.gnu.org/onlinedocs/gnat_rm/Pragma-Obsolescent.html

--
Ludovic Brenta.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-01-21  9:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-21  3:47 No "pragma Deprecated (NAME)"? Michael R
2010-01-21  3:57 ` Jeffrey R. Carter
2010-01-21  4:00   ` Michael R
2010-01-21  9:30     ` Ludovic Brenta

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