comp.lang.ada
 help / color / mirror / Atom feed
From: Thomas Hood <thomas@ifn.com>
Subject: Re: Enumeration literal visibility and use type
Date: 1998/05/28
Date: 1998-05-28T00:00:00+00:00	[thread overview]
Message-ID: <356D767E.41C6@ifn.com> (raw)
In-Reply-To: 6kj7av$qsn@gcsin3.geccs.gecm.com


John McCabe wrote:
> 
> dewar@merv.cs.nyu.edu (Robert Dewar) wrote:
> >John McCabe says

<snip>

> >
> >   package_name."+" (x,y);
> 
> I believe it's simply to do with people's expectations.
> 
> Naturally (well.. you know what I mean) we expect addition of 2 values to
> be represented by x + y, and this is true of most High Level Languages
> that I'm aware of, and C. Therefore it simply appears natural to prefer
> to see x + y rather than package_name."+"(x,y). (Note: I believe that
> both the package name and the ""s tend to distract the reader from the
> meaning in these cases).

<snip>

My usual Ada83 way around this was to import the operator using a
renames clause.
i.e.  function "+"(l,r : my_pkg.my_type) return my_pkg.my_type renames
my_pkg."+";

This allows the infix use of the binary operator.  It is still clumsy
and not very pretty but it sure makes the body of the code read better.

Thomas Hood
thomas@ifn.com
thomas@yachtrace.net




  parent reply	other threads:[~1998-05-28  0:00 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <6kej65$dnh$1@hermes.seas.smu.edu| <6kejt5$75u@gcsin3.geccs.gecm.com>
1998-05-26  0:00 ` Enumeration literal visibility and use type William Bralick
1998-05-26  0:00   ` Fergus Henderson
1998-05-27  0:00     ` William Bralick
1998-05-27  0:00     ` John McCabe
1998-05-27  0:00       ` Robert Dewar
1998-05-28  0:00         ` John McCabe
1998-05-28  0:00           ` Robert Dewar
1998-05-29  0:00             ` John McCabe
1998-05-28  0:00           ` Thomas Hood [this message]
1998-05-28  0:00             ` Robert Dewar
1998-05-27  0:00       ` Peter Amey
1998-05-27  0:00         ` John McCabe
1998-05-26  0:00 William Bralick
1998-05-26  0:00 ` Matthew Heaney
1998-05-27  0:00   ` William Bralick
1998-05-27  0:00   ` Mats Weber
1998-05-27  0:00   ` John McCabe
1998-05-26  0:00 ` John McCabe
1998-05-26  0:00   ` David C. Hoos, Sr.
1998-05-26  0:00     ` Matthew Heaney
1998-05-27  0:00       ` John McCabe
1998-05-26  0:00     ` John English
1998-05-26  0:00     ` Ray Blaak
1998-05-27  0:00       ` John McCabe
1998-05-27  0:00         ` John McCabe
1998-05-27  0:00     ` Robert Dewar
1998-05-27  0:00       ` Matthew Heaney
1998-05-26  0:00 ` Roger Racine
replies disabled

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