comp.lang.ada
 help / color / mirror / Atom feed
* Type of the target of an assignment shall not be abstract
@ 2010-02-14 14:20 Gautier write-only
  2010-02-14 17:57 ` Dmitry A. Kazakov
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Gautier write-only @ 2010-02-14 14:20 UTC (permalink / raw)


Hello,

A question for the RM hermeneutists.
The instruction marked below with ">>>" goes well through one Ada 95
compiler (GNAT with -gnat95) but is not accepted by another one
(ObjectAda 7.2.2).
Which compiler is right ?

  procedure Init(
    xl        : in out Excel_Out_Stream'Class;
    format    :        Excel_type:= Default_Excel_type
  )
  is
    dummy_xl_with_defaults: Excel_Out_File;
  begin
    -- Check if we are trying to re-use a half-finished object
(ouch!):
    if xl.is_created and not xl.is_closed then
      raise Excel_Stream_Not_Closed;
    end if;
    dummy_xl_with_defaults.format:= format;
>>> Excel_Out_Stream(xl):= Excel_Out_Stream(dummy_xl_with_defaults);
  end Init;

>>> excel_out.adb: Error: line 595 col 5 LRM:3.9.3(8), The type of the target of an assignment shall not be abstract

For those asking themselves what the *@#$! that code is doing, since
the xl variable is already initialized, the purpose of the := is to re-
initialize an object (xl) with the default values of the root type.
Since the root type is abstract, I need a concrete derived object
(dummy_xl_with_defaults) to get these default values. Subsidiary
question: is there another way of doing that in one ':=' ?

The whole package is visible @ http://excel-writer.sourceforge.net/ew_html/excel_out__adb.htm#553_13
______________________________________________________________
Gautier's Ada programming -- http://gautiersblog.blogspot.com/



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

end of thread, other threads:[~2010-02-28 17:00 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-14 14:20 Type of the target of an assignment shall not be abstract Gautier write-only
2010-02-14 17:57 ` Dmitry A. Kazakov
2010-02-15 17:05 ` Adam Beneschan
2010-02-15 19:00   ` Hibou57 (Yannick Duchêne)
2010-02-23 21:19     ` Robert A Duff
2010-02-16  0:59   ` Adam Beneschan
2010-02-16 10:03     ` Gautier write-only
2010-02-16 12:14       ` Gautier write-only
2010-02-16 16:12       ` Adam Beneschan
2010-02-28 17:00 ` Gautier write-only

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