Path: utzoo!utgpu!watmath!att!tut.cis.ohio-state.edu!bloom-beacon!mit-eddie!uw-beaver!uw-entropy!elk!adrianb From: adrianb@elk.stat.washington.edu (Adrian Baddeley) Newsgroups: comp.lang.c++ Subject: Re: Named arguments? Message-ID: <2180@uw-entropy.ms.washington.edu> Date: 15 Aug 89 20:47:41 GMT References: <612@windy.dsir.govt.nz> <2179@uw-entropy.ms.washington.edu>Sender: news@uw-entropy.ms.washington.edu Reply-To: adrianb@castor.ms.washington.edu Organization: UW Statistics, Seattle Lines: 36 In article Neal Gafter writes: >I have not 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); > int result = distance(scale: scale1, x: x1, y: y1, z: z1); > >Opinions? Looks good. The calling syntax resembles an interpreter that I once wrote for image processing. (It didn't have your nice declaration syntax.) y = subset(x, margin:10) z = transform(x, table: y ) print(x, copies:2, title:"Image X", pipe:"lpr -Pps") This seemed to satisfy users (as does 'S'). 'S' has a mechanism for testing in the function body whether a named argument was present in the function call, even if it was assigned the default value. Is this a good idea??? ---- adrianb@castor.ms.washington.edu (until 21 august 1989) Adrian Baddeley, visiting Department of Statistics GN-22, University of Washington, Seattle WA 98195, USA. tel (U of W): +1 206 545-2617 / 543-7237