Re: [stack] Parameters: ordered versus named
"Joe Bowbeer" <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
On 9/7/07, Manfred Von Thun <[email protected]> wrote: > > In such languages definitions would again look as in > lambda calculus languages: > > DEFINE foo(x,y,z) # head of definition > = ...x...y...z... # body of definition > > As before, you can change the order of the parameters > without any need to change the body of the definition. > But a call would look quite different: instead of relying > on the order of the formal parameters, use their names > as assignment statements, and make the assignments > in any order. Hence any of the following would be OK > as a call: > > foo(x=a; y=b; z=c) > foo(y=b; z=c; x=a) > foo(z=c; y=b; x=a) > Python has optional keyword arguments with default values: http://docs.python.org/tut/node6.html#SECTION006720000000000000000 E.g., eggs(x=a, y=b, z=c) See also: http://en.wikipedia.org/wiki/Named_parameter --Joe PS - This also reminds me of dynamic binding in LISP, where you could do something degenerative like: (let ((x a) (y b) (z c)) foo())