comp.lang.ada
 help / color / mirror / Atom feed
From: ok@goanna.cs.rmit.edu.au (Richard A. O'Keefe)
Subject: Re: Ada vs. C++ (Readability)
Date: 1997/09/15
Date: 1997-09-15T00:00:00+00:00	[thread overview]
Message-ID: <5vij6m$dvj$1@goanna.cs.rmit.edu.au> (raw)
In-Reply-To: 5v9nrm$8lp@panix.com



hymie@panix.com (Hyman Rosen) writes:
>What exactly is it about 'ray x = 1, 2, 3;' that you find unreadable?

The fact that the comma operator has a standard reading which is completely
at variance with this one.  Overloading one sequencing operator (comma)
makes precisely as much sense as overloading the other sequencing symbol
(semicolon).  Especially in a declaration, I invite you to consider

	int y;
	ray x = 1, 2, y = 3, 4;

Is this a _legal_ declaration for a ray x where one component is the
value of the assignment y = 3, or is it an _illegal_ attempt to declare
two rays, one of the called x and initialised to 1, 2 and the other
called y and initialised to 3, 4.  Does the answer change if the first
declaration of y is deleted?

I note that the C9X standard introduces in-line aggregates, so that e.g.

	ray x(3, (int[]){0, 1, 2});

would be possible.  The sooner C++ gets this, the better.


>The overloading lets you write vector and matrix initializations in a
>completely transparent fashion.

It is not _completely_ transparent, because these comma operations can
occur in syntactic contexts where the _other_ readings of comma are
available, as shown above.

>In any case, this is part of the interface of a library for high-speed
>computation, and is described clearly in that library's documentation
>and examples. I would expect that someone maintaining this code would
>first acquaint themselves with this, if they are to have any chance of
>success at all.

That's not the problem.  The problem is that _even when you know what it
means_, it still appears ambiguous.


-- 
Unsolicited commercial E-mail to this account is prohibited; see section 76E
of the Commonwealth Crimes Act 1914 as amended by the Crimes Legislation
Amendment Act No 108 of 1989.  Maximum penalty:  10 years in gaol.
Richard A. O'Keefe; http://www.cs.rmit.edu.au/%7Eok; RMIT Comp.Sci.




  parent reply	other threads:[~1997-09-15  0:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-09-09  0:00 Ada vs. C++ (Readability) Joerg Rodemann
1997-09-09  0:00 ` Hyman Rosen
1997-09-10  0:00   ` Simon Wright
1997-09-11  0:00     ` Robert Dewar
1997-09-11  0:00       ` Hyman Rosen
1997-09-12  0:00         ` Joerg Rodemann
1997-09-15  0:00         ` Richard A. O'Keefe [this message]
1997-09-10  0:00   ` Joerg Rodemann
1997-09-11  0:00     ` Hyman Rosen
replies disabled

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