comp.lang.ada
 help / color / mirror / Atom feed
From: "Yannick Duchêne (Hibou57)" <yannick_duchene@yahoo.fr>
Subject: Re: package Ada.Tags
Date: Fri, 08 Jun 2012 11:50:30 +0200
Date: 2012-06-08T11:50:30+02:00	[thread overview]
Message-ID: <op.wfkwaguhule2fv@douda-yannick> (raw)
In-Reply-To: m2mx4elsa8.fsf@pushface.org

Le Thu, 07 Jun 2012 23:35:11 +0200, Simon Wright <simon@pushface.org> a  
écrit:

> "RasikaSrinivasan@gmail.com" <RasikaSrinivasan@gmail.com> writes:
>
>>    procedure show (event : events_record_type) is
>>       use GNAT.Calendar.Time_IO;
>>    begin
>>       put( ada.Tags.Expanded_Name( event'tag ) );
>>       put( gnat.Calendar.time_io.Image( event.time ,  
>> gnat.Calendar.Time_IO.ISO_Date & " %T")) ;
>>    end show;
>>
>> gives me a compilation error:
>>
>> "tag" attribute can only be applied to objects of class - wide type.
>>
>> In the above, isnt event an object meeting this criterion?
>>
>> clearly i am missing something. The question is I want to find out the
>> equivalent of RTTI from C++. ie Which one if the derived types is it.
>
> You can get it to compile by converting the object 'event' of a specific
> type to the class-wide type:
>
>   Events_Record_Type'Class (Event)'Tag

Forgive me for being pedantic, but it's important to note this is not a  
type conversion, that's a *view conversion*.

-- 
“Syntactic sugar causes cancer of the semi-colons.” [1]
“Structured Programming supports the law of the excluded muddle.” [1]
[1]: Epigrams on Programming — Alan J. — P. Yale University



  parent reply	other threads:[~2012-06-08  9:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-07 20:36 package Ada.Tags RasikaSrinivasan
2012-06-07 21:35 ` Simon Wright
2012-06-07 21:48   ` RasikaSrinivasan
2012-06-08  9:50   ` Yannick Duchêne (Hibou57) [this message]
2012-06-08  9:59     ` Dmitry A. Kazakov
2012-06-08 15:26     ` Adam Beneschan
2012-06-08 16:31     ` Simon Wright
2012-06-07 21:49 ` Adam Beneschan
replies disabled

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