comp.lang.ada
 help / color / mirror / Atom feed
* GNAT-Problem / Please Help !!
@ 1994-11-07 13:54 Andreas Krohn
  1994-11-12 21:31 ` Tucker Taft
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Andreas Krohn @ 1994-11-07 13:54 UTC (permalink / raw)


I've a problem with the Set_Col() and Set_Line() Functions.
Everytime I use a number the call works, but when i use a variable
in the call the compiler says "invalid parameter list in call".
Could anybody help an ada-beginner with the problem ?

Thank you.
 



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

* Re: GNAT-Problem / Please Help !!
  1994-11-07 13:54 GNAT-Problem / Please Help !! Andreas Krohn
@ 1994-11-12 21:31 ` Tucker Taft
  1994-11-13 12:41 ` Robert Dewar
  1994-11-17 23:27 ` Keith Thompson
  2 siblings, 0 replies; 5+ messages in thread
From: Tucker Taft @ 1994-11-12 21:31 UTC (permalink / raw)


In article <39lbil$euf@tucs6.rz.tu-cottbus.de>,
Andreas Krohn <ak@informatik.tu-cottbus.de> wrote:

>I've a problem with the Set_Col() and Set_Line() Functions.
>Everytime I use a number the call works, but when i use a variable
>in the call the compiler says "invalid parameter list in call".
>Could anybody help an ada-beginner with the problem ?

You probably have a type mismatch.  Set_Col and Set_Line both expect
parameters of subtype Text_IO.Positive_Count.  When you use
numeric literals, you don't need to worry about the particular integer
type.  But when you use a variable, you need to declare it to be
of the right (sub)type, or convert it on use.  For example, the following
should work:

   C : Text_IO.Positive_Count;
 ...
   C := 22;
   Text_IO.Set_Col(C);

Alternatively, you can write:

   X : Integer;
 ...
   X := 22;
   Text_IO.Set_Col(Text_IO.Positive_Count(X));

The former is methodologically preferable, in general, because it makes
it clear that "C" represents a count to be used with Text_IO column
and line operations.

-Tucker Taft  stt@inmet.com
Intermetrics, Inc.
Cambridge, MA  02138
The problem is that 
>
>Thank you.
> 





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

* Re: GNAT-Problem / Please Help !!
  1994-11-07 13:54 GNAT-Problem / Please Help !! Andreas Krohn
  1994-11-12 21:31 ` Tucker Taft
@ 1994-11-13 12:41 ` Robert Dewar
  1994-11-17 23:27 ` Keith Thompson
  2 siblings, 0 replies; 5+ messages in thread
From: Robert Dewar @ 1994-11-13 12:41 UTC (permalink / raw)


GNAT problems should be reported to gnat-report@cs.nyu.edu. Always include
full sources, it is usually impossible for us to deal with problems without
the full sources. FOr example, in this case, Set_Col is certainly not
broken to the extent that is claimed, so it is probably a programming
error, but we can't guess what the error might be without the sources!
Also remember to say what machine and what version you are using (the
latest GNAT BUG box includes this information automatically).




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

* Re: GNAT-Problem / Please Help !!
  1994-11-07 13:54 GNAT-Problem / Please Help !! Andreas Krohn
  1994-11-12 21:31 ` Tucker Taft
  1994-11-13 12:41 ` Robert Dewar
@ 1994-11-17 23:27 ` Keith Thompson
  1994-11-19  7:19   ` Robert Dewar
  2 siblings, 1 reply; 5+ messages in thread
From: Keith Thompson @ 1994-11-17 23:27 UTC (permalink / raw)


In <39lbil$euf@tucs6.rz.tu-cottbus.de> ak@informatik.tu-cottbus.de (Andreas Krohn) writes:
> I've a problem with the Set_Col() and Set_Line() Functions.
> Everytime I use a number the call works, but when i use a variable
> in the call the compiler says "invalid parameter list in call".

We've spent so much time discussing the evils and benefits of strong
typing that we've neglected the real problem -- an unhelpful error
message.

Someone should probably send a note to the GNAT bugs mailing list about
the error message.  A message about a type mismatch for the specific
parameter involved would be more helpful than a complaint that the entire
parameter list is invalid.  I'd send it in myself, but I don't remember
the address and I don't have a copy of GNAT to reproduce the problem.

Of course, this kind of thing can be very difficult to do in the presence
of overloading and default parameters.  Given a call whose parameters
don't match any of the visible overloaded subprograms of a given name,
the compiler would have to "guess" which one the user had in mind and
which parameter is of the wrong type (sort of like automated spelling
correction but with more degrees of freedom -- if that makes any sense).
It might be worthwhile to have special-case recovery for non-overloaded
subprograms.

In any case, I wouldn't expect the GNAT team to spend too much time on
fancy error detection and recovery when there are still language features
to implement.

-- 
Keith Thompson (The_Other_Keith)  kst@alsys.com
TeleSoft^H^H^H^H^H^H^H^H Alsys, Inc.
10251 Vista Sorrento Parkway, Suite 300, San Diego, CA, USA, 92121-2718
/user/kst/.signature: I/O error (core dumped)



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

* Re: GNAT-Problem / Please Help !!
  1994-11-17 23:27 ` Keith Thompson
@ 1994-11-19  7:19   ` Robert Dewar
  0 siblings, 0 replies; 5+ messages in thread
From: Robert Dewar @ 1994-11-19  7:19 UTC (permalink / raw)


Regarding Keith's comment on the error message, that's quite right, we don't
give a helpful error message for an incorrect use of Set_Col.

The reason is that Set_Col is overloaded. If a function is not overloaded,
there is no problem, and we give a nice message, but overloading makes
it tricky.

We disussed specially recognizing the case of varying number of parameters,
which is a special case (which applies to Set_Col) and might be a path
for a better error message.




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

end of thread, other threads:[~1994-11-19  7:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1994-11-07 13:54 GNAT-Problem / Please Help !! Andreas Krohn
1994-11-12 21:31 ` Tucker Taft
1994-11-13 12:41 ` Robert Dewar
1994-11-17 23:27 ` Keith Thompson
1994-11-19  7:19   ` Robert Dewar

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