comp.lang.ada
 help / color / mirror / Atom feed
From: portal!cup.portal.com!R_Tim_Coslet@uunet.uu.net
Subject: Re: Difference between a function and an operation
Date: 25 Sep 92 02:19:25 GMT	[thread overview]
Message-ID: <66561@cup.portal.com> (raw)

In article: <1992Sep24.152726.17404@linus.mitre.org>
	jclander@texas.mitre.org (Julian C. Lander) wrote...
>You've got it right.  Operations in Ada are functions, which is why
>the overloading works.  You can't overload the function "/=", because
>that is defined to be the opposite of "=", which can be overloaded.
>
>The operational notation is merely a notational convenience. I
>don't remember offhand when you can use it for your own defined
>functions, and I'm too lazy to check the LRM.

The only functions that can use the "operational notation" are functions
of 1 or 2 parameters whose names are the predefined operators having
the same number of parameters (e.g. "+"(x,y), "-"(x,y), "-"(x), "*"(x,y),
"/"(x,y), ">"(x,y), "<"(x,y), etc....). It is not permitted in Ada to
name functions with "operator symbols" that are not already defined in the
language (e.g. "!"(x) could not be used to define a factorial operator
function of x).

It is possible to use the Renames declaration to rename a function
originally defined with a name so that it may now be refered to using
an operator notation (if it already has the matching number of parameters).

e.g.
	function "+"(x,y) renames fancy_sum(x,y);

(don't take the above example as correct Ada syntax, refer to the LRM
 for the right syntax for this statement. I left my LRM at work.)

                                        R. Tim Coslet

Usenet: R_Tim_Coslet@cup.portal.com
        technology, n.  domesticated natural phenomena

             reply	other threads:[~1992-09-25  2:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1992-09-25  2:19 portal!cup.portal.com!R_Tim_Coslet [this message]
  -- strict thread matches above, loose matches on Subject: below --
1992-09-29 18:57 Difference between a function and an operation Robert I. Eachus
1992-09-24 15:27 Julian C . Lander
replies disabled

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