rfc:namedparameters

Request for Comments: Named Parameters (obsolete)

  • Version: 0.1
  • Date: 2012-04-13
  • Author: Needs an owner & champion else this project will not be considered
  • Status: Draft - no content except a very old decision on the topic
  • Superseded by: Named Parameters RFC

Introduction

Note: This RFC has been superseded by another Named Parameters RFC.

This document is a placeholder for a future RFC on implementing Named Parameters. This project needs an owner.

Named Parameters is a topic that has been raised many times over the years. The pros and cons are captured in a variety of emails and (obviously) the feature has not gained support and is not implemented.

Since the topic continually gets re-raised, and now PHP has an RFC process, the discussion should be recorded in an RFC (Note this is yet to be done) so the same arguments don't have to be revisited.

Paris Meeting 2005

As a start, a summary is contained in the Paris meeting minutes from 2005:

Issue

The functionality of named parameters was suggested. Named parameters allow you to “skip” certain parameters to functions. If it would be implemented, then it might look like:

<?php
function foo ($a = 42, $b = 43, $c = 44, $d = 45)
{
      // echos 42, 53, 54, 45
      echo "$a $b $c $d\n";
}

foo(c => 54, b => 53);
?>

Discussion

We don't see the real need for named parameters, as they seem to violate PHP's KISS principle. It also makes for messier code.

Conclusions

We do not want to add it.

Current Discussion

All the pros & cons raised since 2005 need to be extracted from the mail archives and added here.

rfc/namedparameters.txt · Last modified: 2013/09/09 17:32 by nikic