* Re: defining functions
1999-11-25 0:00 defining functions Riyaz Mansoor
` (2 preceding siblings ...)
1999-11-24 0:00 ` Ted Dennison
@ 1999-11-24 0:00 ` Matthew Heaney
1999-11-25 0:00 ` Robert Dewar
4 siblings, 0 replies; 7+ messages in thread
From: Matthew Heaney @ 1999-11-24 0:00 UTC (permalink / raw)
In article <81gthb$kej$1@bunyip.cc.uq.edu.au> , "Riyaz Mansoor"
<s800032@student.uq.edu.au> wrote:
> when i try to define a function as below my compiler tells me the name is
> invalid. when i change the name to "=" it works fine. is this a compiler
> specific problem? or ada restriction?
This is not an Ada "restriction." This is an Ada *feature*.
> function "==" (Stack1, Stack2 : in Stack) return Boolean;
Wrong. Do this instead:
function "=" (L, R : Stack) return Boolean;
> if this is a compiler problem, i'm using AdaGIDE (GNAT 3.12), is there
> anyway i can tell the compiler to accept "==" as a valid name?
No. Look up the list of valid operators in the RM.
> (i find the single equal sign really irritating!!!)
I'm sorry to hear that.
--
Get the FAQs about evolution and creationism.
<http://www.talkorigins.org/origins/faqs.html>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: defining functions
1999-11-25 0:00 defining functions Riyaz Mansoor
1999-11-24 0:00 ` Gautier
@ 1999-11-24 0:00 ` Lutz Donnerhacke
1999-11-24 0:00 ` Ted Dennison
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Lutz Donnerhacke @ 1999-11-24 0:00 UTC (permalink / raw)
* Riyaz Mansoor wrote:
>anyway i can tell the compiler to accept "==" as a valid name?
>(i find the single equal sign really irritating!!!)
May be, but "==" is not a valid binary Operator in Ada. So you can not
define it.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: defining functions
1999-11-25 0:00 defining functions Riyaz Mansoor
1999-11-24 0:00 ` Gautier
1999-11-24 0:00 ` Lutz Donnerhacke
@ 1999-11-24 0:00 ` Ted Dennison
1999-11-25 0:00 ` Riyaz Mansoor
1999-11-24 0:00 ` Matthew Heaney
1999-11-25 0:00 ` Robert Dewar
4 siblings, 1 reply; 7+ messages in thread
From: Ted Dennison @ 1999-11-24 0:00 UTC (permalink / raw)
In article <81gthb$kej$1@bunyip.cc.uq.edu.au>,
"Riyaz Mansoor" <s800032@student.uq.edu.au> wrote:
> when i try to define a function as below my compiler tells me the name
> is invalid. when i change the name to "=" it works fine. is this a
> compiler specific problem? or ada restriction?
>
> function "==" (Stack1, Stack2 : in Stack) return Boolean;
No. You do not get to create your own binary operators with any series
of random characters you choose. You are restricted to the ones the
language provides. I was a smidge diappointed when I first figured that
out myself.
> anyway i can tell the compiler to accept "==" as a valid name?
No. You'll have to stick to Ada/Pascal/Modula/Oberon syntax for equality
and assignment. Sorry.
But on the bright side, you'll make less compilable typos this way.
--
T.E.D.
Sent via Deja.com http://www.deja.com/
Before you buy.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: defining functions
1999-11-25 0:00 defining functions Riyaz Mansoor
@ 1999-11-24 0:00 ` Gautier
1999-11-24 0:00 ` Lutz Donnerhacke
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Gautier @ 1999-11-24 0:00 UTC (permalink / raw)
> (i find the single equal sign really irritating!!!)
Ah.
The fact that "=" means "equal" does worry you ?!
How strange...
Unless you had too much violent images in your childhood,
like "==" meaning "equal",
"=" meaning "let... be..."
"a=-b" meaning either "substract b to a", or "let a be -b"
etc.
;-)
--
Gautier
_____\\________________\_______\
http://members.xoom.com/gdemont/
^ permalink raw reply [flat|nested] 7+ messages in thread
* defining functions
@ 1999-11-25 0:00 Riyaz Mansoor
1999-11-24 0:00 ` Gautier
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Riyaz Mansoor @ 1999-11-25 0:00 UTC (permalink / raw)
hi there
when i try to define a function as below my compiler tells me the name is
invalid. when i change the name to "=" it works fine. is this a compiler
specific problem? or ada restriction?
function "==" (Stack1, Stack2 : in Stack) return Boolean;
if this is a compiler problem, i'm using AdaGIDE (GNAT 3.12), is there
anyway i can tell the compiler to accept "==" as a valid name?
(i find the single equal sign really irritating!!!)
thanx
----------------------------------------------------
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: defining functions
1999-11-25 0:00 defining functions Riyaz Mansoor
` (3 preceding siblings ...)
1999-11-24 0:00 ` Matthew Heaney
@ 1999-11-25 0:00 ` Robert Dewar
4 siblings, 0 replies; 7+ messages in thread
From: Robert Dewar @ 1999-11-25 0:00 UTC (permalink / raw)
In article <81gthb$kej$1@bunyip.cc.uq.edu.au>,
"Riyaz Mansoor" <s800032@student.uq.edu.au> wrote:
> function "==" (Stack1, Stack2 : in Stack) return Boolean;
> (i find the single equal sign really irritating!!!)
One of the things that is important when you come to a new
language is to understand the style and conform to it. Nothing
would be more horrible (*) than seeing == used in an Ada
program, and it is in this case an excellent thing that the
compiler prevents this abuse.
(*) well I guess a comparable thing would be to see an Ada
programmer writing C, and starting off with
#define begin {
#define end }
etc.
Unfortunately the C preprocessor WOULD allow this appalling
abuse of the macro processor.
Sent via Deja.com http://www.deja.com/
Before you buy.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: defining functions
1999-11-24 0:00 ` Ted Dennison
@ 1999-11-25 0:00 ` Riyaz Mansoor
0 siblings, 0 replies; 7+ messages in thread
From: Riyaz Mansoor @ 1999-11-25 0:00 UTC (permalink / raw)
> No. You do not get to create your own binary operators with any series
> of random characters you choose. You are restricted to the ones the
> language provides. I was a smidge diappointed when I first figured that
> out myself.
> No. You'll have to stick to Ada/Pascal/Modula/Oberon syntax for equality
> and assignment. Sorry.
>
> But on the bright side, you'll make less compilable typos this way.
thanx TED. u really answered my question.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~1999-11-25 0:00 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-11-25 0:00 defining functions Riyaz Mansoor
1999-11-24 0:00 ` Gautier
1999-11-24 0:00 ` Lutz Donnerhacke
1999-11-24 0:00 ` Ted Dennison
1999-11-25 0:00 ` Riyaz Mansoor
1999-11-24 0:00 ` Matthew Heaney
1999-11-25 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