comp.lang.ada
 help / color / mirror / Atom feed
* Ada as 2nd Lang, p. 678
@ 1997-05-01  0:00 John M. Greer
  1997-04-30  0:00 ` Matthew Heaney
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: John M. Greer @ 1997-05-01  0:00 UTC (permalink / raw)



I was wondering if anyone could help for a second . . .
Ada as a Second Language (My favorite book) gives this listing
for an example using Generic subprograms, but GNAT complains of end-of-line;
it sees the declaration and stops.
"end of file expected, file can have only one compilation unit
gnatmake: "cyclic_successor_template.adb" compilation error"

GENERIC
   TYPE Discrete_Type IS (<>);
   FUNCTION Cyclic_Successor_Template (X : Discrete_Type) RETURN Discrete_Type;

--Generic subprogram body:

   FUNCTION Cyclic_Successor_Template (X:Discrete_Type) RETURN Discrete_Type IS
   BEGIN
      IF X = Discrete_Type'Last THEN
	 RETURN Discrete_Type;First;
      ELSE
	 RETURN Discrete_Type'Succ(X);
      END IF;
   END Cyclic_Successor_Template;





^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: Ada as 2nd Lang, p. 678
@ 1997-05-12  0:00 Marin David Condic, 561.796.8997, M/S 731-93
  1997-05-13  0:00 ` Robert Dewar
  0 siblings, 1 reply; 7+ messages in thread
From: Marin David Condic, 561.796.8997, M/S 731-93 @ 1997-05-12  0:00 UTC (permalink / raw)



nickerson@MIRAGE.VMS.BOEING.COM writes:
>it may "generally" be a bad idea, but "specifically" when one is
>trying something out or has existing code it is the "reasonable"
>thing to try; I quite identify with John - myself having used a
>compiler which did the "expected" thing and allowed multiple units
>per file;
>
    I have found that in circumstances where I want more than one
    compilation unit in the same file (say, because I'm doing
    quick-&-dirty concept testing or I'm e-mailing the implementation
    back & forth with another implementor) that I can get by just fine
    using gnatchop.

    Typically, I'll edit a file called <app-name>.chop, save the file,
    do a "gnatchop -w <app-name>.chop", followed by a "gnatmake
    main_unit". It works pretty well if I want the whole program in
    one file. (I haven't figured out how to get gnatchop to work in a
    .BAT file - my ignorance of MS-DOS no doubt. But that might
    provide a means of building a compilation procedure that separates
    out anything where you've combined spec/body for a specific
    reason.) I'll admit it's not the best of all possible worlds, but
    it does work and is not so inconvenient as to make it impossible
    to live with.

    MDC

Marin David Condic, Senior Computer Engineer    ATT:        561.796.8997
Pratt & Whitney, GESP                           Fax:        561.796.4669
West Palm Beach, FL                             Internet:   CONDICMA@PWFL.COM
===============================================================================
    "You see that ****ing fish? If he'd kept his mouth shut he
    wouldn'ta got caught."

        --  Sam Giancana, on a stuffed swordfish
===============================================================================




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

end of thread, other threads:[~1997-05-13  0:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-05-01  0:00 Ada as 2nd Lang, p. 678 John M. Greer
1997-04-30  0:00 ` Matthew Heaney
1997-05-02  0:00 ` Robert Dewar
1997-05-09  0:00   ` nickerson
1997-05-12  0:00 ` Norman H. Cohen
  -- strict thread matches above, loose matches on Subject: below --
1997-05-12  0:00 Marin David Condic, 561.796.8997, M/S 731-93
1997-05-13  0:00 ` Robert Dewar

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