Talk:Named parameter

MATLAB
I think it is misleading to claim that MATLAB has named arguments. If whoever included MATLAB is referring to the varargs convention like foo('par1', 5, 'par2', 34), that is hacking named arguments, and does not constitute language support (since to use it requires explicit parsing).

I've removed MATLAB from the list. If some one can justify it (and give a cite) then put it back. 70.179.23.194 (talk) 04:42, 18 August 2009 (UTC)

Needs sources and/or external references; more expansion beyond C/Java/Smalltalk would be a plus. Grammar and presentation need work &emdash; the article needs to have a much more encyclopedic tone, and examples with similar syntax would be a welcome improvement (for example, a method call presented twice in the same language, once with named parameters and once with ordinary parameters). --bmills 01:50, 16 January 2006 (UTC)

There has been discussion on "keyword parameters" on comp.lang.fortran.

It seems that to some people "keyword parameters" are what are here called "named parameters". Others believe that "keyword" has another meaning and shouldn't be used with this meaning.

I have known them called "keyword parameters" at least since JCL and OS/360 assembler macros since around 1974, and I believe other systems and languages also use "keyword" with this meaning.

I would rather not get into the parameter/argument discussion, though.

this article could use some work
I may get to it someday. dr.ef.tymac (talk) 04:01, 25 July 2008 (UTC)

ADA has also Named Parameters
http://en.wikibooks.org/wiki/Ada_Programming/Subprograms#Named_parameters

Janburse (talk) 11:00, 30 March 2012 (UTC)

Pass-by-name?
I don't think "pass-by-name", as listed in the first paragraph, is an appropriate alternate term. A quick Google search turns up that this is considered the same as call-by-name, which is not at all like named parameters. See Evaluation strategy. Call-by-name is when you pass an entire expression in as a parameter, and its evaluation is delayed until it is used, and re-evaluated each time it is used. We should remove "pass-by-name" from the list in the first paragraph, unless anyone can name a language that uses that term for named parameters. — Preceding unsigned comment added by Qseep (talk • contribs) 03:23, 5 January 2014 (UTC)

Objective-C does not have named parameters
In many parts of the article Objective-C is mentioned as one of the languages supporting named parameters. Apple, however, denies this by stating that "Some programming languages allow function definitions with so-called named arguments; it’s important to note that this is not the case in Objective-C" (I assume named parameters and named arguments are equivalent). The Objective-C syntax is however similar so maybe it should just be rephrased? Or, if Objective-C does have named parameters by the common definition, it should be mentioned in the article that Apple denies it. --LoPoBo (talk) 10:28, 7 February 2014 (UTC)


 * I have modified the article now. --LoPoBo (talk) 08:32, 28 August 2017 (UTC)


 * if Objective-C doesn't have named parameters then Smalltalk and Self don't either. And while technically they don't (they have compound method names instead), functionally the result is the same, they have all the advantages of named parameters. — Preceding unsigned comment added by 212.68.230.219 (talk) 12:22, 27 July 2020 (UTC)


 * The same goes for Swift. Example valid Swift code which shows that it does not have named parameters:
 * ( and   are argument labels) --LoPoBo (talk) 08:41, 28 August 2017 (UTC)

Named ~arguments~, not named parameters
Named arguments is a more suitable term for the act of mapping an argument to a parameter name, and is used by companies working on modern languages (such as Microsoft with C# and Jetbrains with Kotlin).

Named parameters implies giving a name to a parameter, which does not properly describe the topic at hand. It may even be infered as aliasing a parameter, as the term "parameter" is used in the context of implementation rather than usage.

Using Google Trends, named arguments seems to fluctuate alongside named parameters, and within the past 30 days, there shows less than a 10 query difference between the two. Older languages, such as Ada and Fortran, have made the term "named parameters" a popular topic, yet doesn't fully describe the behavior being perform.

The current subcategory for optional parameters links to the page Default Arguments - a synonym for optional arguments. Renaming Named Parameters to Named Arguments would help maintain consistency and better describe the behavior. — Preceding unsigned comment added by Ipwxy (talk • contribs) 04:14, 25 August 2017 (UTC)


 * I believe that they are, fully, "named-parameter arguments". Clhodapp (talk) 03:59, 21 August 2018 (UTC)


 * I agree, a function definition has parameters while a function call has arguments. However I used "named parameters" below because it is the article name. elias

Functions are binary relations, either tuple or record sets may be domains
A mathematical function is a binary relation with the restriction that the first entry in the tuple can not appear in two different tuples in the relation.

---Hold it!, hold it! What about binary and ternary functions, they have two or three arguments---

That is just a colloquial name. Have you seen this kind of definitions in your maths book:

$$ f:\mathbb{R}\times\mathbb{R}\to\mathbb{R}$$

the first entry in a function $$f$$ is taken from a domain set and the second entry is taken from a codomain set. In the above example $$ f =\{ (x,y): x\in \mathbb{R}\times\mathbb{R} \land y\in \mathbb{R}\}$$

$$\mathbb{R}\times\mathbb{R}$$ is the domain, and $$\mathbb{R}$$ is the codomain.

The members of $$\mathbb{R}\times\mathbb{R}$$ are tuples. What is colloquially called a binary function is a function with tuples as a domain.

The majority of programming languages lack tuples as data types, they are only used in function call and definition, but not freely available in other places.

Some languages have records or structures as data types, in many of such languages it is possible to define functions which have as a domain a set of records.

As shown in the example tuples are ordered, while records, being labelled are unordered.

Named parameters are syntactic sugar for functions with record sets instead of tuple sets as domains.

Pre-processing or macros may be used. The following example use macros: it is not the safest way, but possible to implement in plain C.

Another syntactic sugar present in languages with named parameters is default values for arguments and optional parameters.

Is it a key feature in programming languages? Not really. Records and tuples are equivalent.

However the other features often present in languages with named parameters, like code with optional parameters are risky if it is possible to omit a default value, although the usual way to declare them as optional is to assign them a default value otherwise they could be a source for not initialized variables.

Default values for optional parameters could be implemented via macros as in the following example:

Optional parameters should not be confused with curried functions, that is a feature of higher order languages. A higher order function has a function as codomain, for example: $$ f : \mathbb{R}\to (\mathbb{R}\to \mathbb{R}) $$

if called as $$f p_1 p_2$$ which is equivalent to $$(f p_1) p_2$$ because function application is left associative. The evaluation of $$f p_1$$ returns a $$\mathbb{R}\to \mathbb{R}$$ function which in turn is applied to the "second" argument $$p_2$$ returning a value in $$\mathbb{R}$$.

That is all the explanation needed for this article.

Yes I know it is not in the Wikipedia style, and some more concrete examples of languages with named parameters should be added. I leave it to another volunteer to rewrite it.

In my opinion named parameters are a nice feature in macro languages like LaTeX and in C programs called from the shell (analysing the command line with  with programner's code or some library functions like   in   or   in  ).

In programming languages I don't see a really useful reason to use named parameters (arguments).

I am not going to discus my reasons here, because that is too long, and an article should not have personal opinions, although I can argue it formally but very lengthily, maybe some other volunteer has some concise argument with a credited citation. elias