comp.lang.ada
 help / color / mirror / Atom feed
From: milo!svh@uunet.uu.net  (Steven Hovater)
Subject: Re: Procedure/function specification/declarations
Date: 27 Apr 92 10:59:41 GMT	[thread overview]
Message-ID: <1992Apr27.105941.12505@verdix.com> (raw)

In article <21295@hacgate.UUCP> hayes%bh_ddemo3@hac2arpa.hac.com writes:
>I'm a beginner to Ada...
>
>
>I've noticed that it is possible to specify a procedure 
>or function without parameters without using a 
>null parameter list specification.  What was the thinking
>behind this or why is this method superior?
>
>For example, in ANSI C a function prototype might be
>   boolean empty (void);
>In Ada, a corresponding specification would be
>   function empty return boolean;
>
>Personally, I like the way C does it: function/procedure 
>_calls_ are always followed by a set of parentheses (
>containing data, obviously, if necessary).  It seems like

"Less is more", eh? Why require parenthesis to indicate
that you don't have anything?

>in Ada, I could come across a piece of code like this:
>
>   if empty then
>   ....
>   endif
>and I wouldn't know from the context if empty was a boolean
>variable or function.  Thus, if I modified the code to make 
>an assignment to empty (empty := FALSE) I wouldn't find out
>until compile time.

Well, it would take a little more than just assignment: you'd
have to go out of your way to declare a boolean variable, and then
make the assignment. Not likely you'd do that by accident.

>From the point of view that you wouldn't know whether it was a
boolean variable or boolean function: you don't really care: 
you're testing a value. In the case of a variable, it's a variable's
value, and in the case of a function it is the function return value.
Boolean is boolean.

>  I do realize that this ambiguity could be argued that it
>is a feature...
>


--
-- 
Steven V. Hovater                      (703)318-5839
Verdix Corporation                     svh@verdix.com

             reply	other threads:[~1992-04-27 10:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1992-04-27 10:59 Steven Hovater [this message]
  -- strict thread matches above, loose matches on Subject: below --
1992-04-27 15:58 Procedure/function specification/declarations yale.edu!spool.mu.edu!umn.edu!sctc.com!stachour
replies disabled

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