Path: utzoo!utgpu!watmath!att!tut.cis.ohio-state.edu!purdue!gatech!udel!rochester!news
From: neal@cs.rochester.edu (Neal Gafter)
Newsgroups: comp.lang.c++
Subject: Re: Named arguments?
Message-ID: 
Date: 15 Aug 89 18:40:15 GMT
References: <612@windy.dsir.govt.nz> <2179@uw-entropy.ms.washington.edu>
Sender: news@cs.rochester.edu (Usenet news)
Organization: University of Rochester, Rochester, New York 14620
Lines: 28

In article <2179@uw-entropy.ms.washington.edu> adrianb@queets.stat.washington.edu (Adrian Baddeley) writes:

> Also, what about named arguments?

Named arguments provide a further method for overload resolution and
allow parameters other than the last ones in the argument list to be
omitted/defaulted.

I have noot seen a good syntax proposed for named arguments, so let me
make a specific proposal that is upwardly-compatible with C++, seems
natural (at least to me), and introduces no ambiguities:

extern int distance(int x, int y, int z, float scale = 1.0);

main()
{
	extern int x1, y1, z1;
	extern float scale;

	int result = distance(scale: scale1, x: x1, y: y1, z: z1);
}

Opinions?
--
Arpa:	neal@cs.rochester.edu (Neal Gafter)
UUCP:	...{rocksvax|allegra|decvax}!rochester!neal
USnail:	Department of Computer Science, U. of Rochester, N.Y. 14627
phone:	(716) 275 - 1348 (office)  or  (716) 473 - 2361 (home)