comp.lang.ada
 help / color / mirror / Atom feed
From: Richard Irvine <Richard.Irvine@eurocontrol.fr>
Subject: Operators Questions
Date: 1996/10/29
Date: 1996-10-29T00:00:00+00:00	[thread overview]
Message-ID: <3275D478.5952@eurocontrol.fr> (raw)


Ada allows overloading of the predefined operators
but not definition of new operators.
Sometimes code could be made more readable if it
were possible to define new operators, e.g.

if   aTimeInterval encloses anotherTimeInterval 
then -- It is clear which interval encloses which.
     ...

instead of

if   encloses(aTimeInterval, anotherTimeInterval)
then -- Which interval enclosed which?
     -- One has to look at the declaration of
     -- the function.
     -- One could use formal parameters, but
     -- then things start to get long-winded.
     ...

I guess that allowing the programmer to define his
own operators creates difficulties for the compiler
writer, or is there some other reason why definition
of new operators is not allowed in Ada? 

Are there languages which do allow defintion of 
new operators?




             reply	other threads:[~1996-10-29  0:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-10-29  0:00 Richard Irvine [this message]
1996-10-29  0:00 ` Operators Questions Robert Dewar
1996-10-29  0:00 ` Norman H. Cohen
1996-11-07  0:00   ` William Frye
1996-10-30  0:00 ` Fergus Henderson
1996-10-30  0:00 ` Matthew Heaney
1996-10-31  0:00   ` Michael F Brenner
1996-10-31  0:00   ` Adam Beneschan
1996-10-31  0:00 ` Jon S Anthony
1996-10-31  0:00   ` Adam Beneschan
1996-11-02  0:00   ` Robert Dewar
1996-11-02  0:00 ` Jon S Anthony
1996-11-05  0:00 ` Jon S Anthony
replies disabled

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