comp.lang.ada
 help / color / mirror / Atom feed
* Operators Questions
@ 1996-10-29  0:00 Richard Irvine
  1996-10-29  0:00 ` Norman H. Cohen
                   ` (6 more replies)
  0 siblings, 7 replies; 13+ messages in thread
From: Richard Irvine @ 1996-10-29  0:00 UTC (permalink / 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?




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

end of thread, other threads:[~1996-11-07  0:00 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-10-29  0:00 Operators Questions Richard Irvine
1996-10-29  0:00 ` Norman H. Cohen
1996-11-07  0:00   ` William Frye
1996-10-29  0:00 ` Robert Dewar
1996-10-30  0:00 ` Matthew Heaney
1996-10-31  0:00   ` Adam Beneschan
1996-10-31  0:00   ` Michael F Brenner
1996-10-30  0:00 ` Fergus Henderson
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

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