Path: utzoo!attcan!uunet!microsoft!alonzo
From: alonzo@microsoft.UUCP (Alonzo Gariepy)
Newsgroups: comp.lang.c++
Subject: Re: Named arguments?
Message-ID: <7421@microsoft.UUCP>
Date: 17 Aug 89 22:42:01 GMT
References: <2179@uw-entropy.ms.washington.edu> <6590229@hplsla.HP.COM>
Reply-To: alonzo@microsoft.UUCP (Alonzo Gariepy)
Organization: Microsoft Corp., Redmond WA
Lines: 33


	Lasciate Ogne Named Arguments, Voi ch'Entrate!

In article <6590229@hplsla.HP.COM> jima@hplsla.HP.COM (Jim Adcock) writes:
>Seems to me passing everything in long function parameter lists, so
>long that you need to give parameters names, offer a zillion options, etc,
>etc, is the antithesis of object oriented programming, and is just the 
>opposite direction of where C++ programming should be going.

Bravo!  Listen to this man and abandon your Named arguments.

Consider the smalltalk method, replaceFrom:to:with:, invoked as:  

	anIndexedCollection replaceFrom: x to: y with: aCollection.  

Who needs named arguments?  You might have another method with the name,
replaceTo:with:, where the starting index defaults to 1.  Anything more
complicated than this simple variation (reflected in the name) is unnecessary.
Since methods should generally contain no more than a dozen or two lines,
long parameter lists are probably symptomatic of design rot.

If you have to set several attributes of an object before beginning
an action, it can be done with several calls.  If the call needs two
sets of three dimensional coordinates (six parameters total) these 
are better passed as two 3D Point objects, at least if you buy much
of the object-oriented programming religion.

My preference is to do away with default arguments altogether, especially
the way they are implemented in C++ (i.e., only trailing arguments may be
omitted).

Alonzo Gariepy				// These opinions do not reflect
alonzo@microsoft			// the policy of Microsoft Corp.