On Wed, Aug 24, 2005 at 10:12:39AM -0700, Chip Salzenberg wrote: > On Wed, Aug 24, 2005 at 08:38:39AM -0400, John Macdonald wrote: > > When calling a function, I would like to be able to have a > > mixture of named and positional arguments. The named argument > > acts as a tab into the argument list and subsequent unnamed > > arguments continue on. > > I see a main point of named parameters to free the caller from the > tyranny of argument order (and vice versa). It seems to me you're > asking for the worst of both worlds.
Perhaps I didn't make it clear in my original message - I agree that arbitrary mixing of named and positional is usually a bad thing. The only place where I find it useful is with a group of arguments that are always provided in the same order, used one or more times each by a number of functions, with additional arguments for some/all of those functions. So, a function that takes position and/or vector values would provide a name for each vector/position, but expect each to have an x, a y, and (possibly) a z argument following the name. I saw this in the DO system - a shell written at CDC back in the late 70's. The provided scripts were designed so that all programming scripts used the same sequence of arguments after the OPT keyword, the LINK keywork, etc. As I said originally, the value is diluted in a language with structured data types - you can use a single argument for a position that is a hash or array which contains the x/y/z components within it. The named group helps especially if you generally want to provide separate-but-related arguments. This tends to be things like an optional sub-action that requires multiple parameters if it is used at all. So, I'm mostly saying that a mixture of named and positional arguments is not ALWAYS bad, and that there may be some value in permitting such a mixture in certain circumstances. --