Option 4 would probably be the worse one to go for. Looking any number
of languages that support defaults and you will see code like ...

someFunction(param1,,,,,param7,,,,param11)

It does get ugly fast for large numbers of arguments...
But any function with more than a handful of arguments is already
asking for trouble...

At that point you should be passing in a data structure / instance /
array or something other than so many parameters.


The above example would have at least 10 arguments, so I'd also say it'd look bad never mind the syntax.

Also a subtle thing: if your email reader doesn't use fixed width font, it's hard to appreciate the look of each approach in an actual code editor. And I'd say commas next to each other appear quite readable, self-sufficient in fixed-width font, not to mention self-explanatory.

Using 'default' would raise more confusion, such as, is that valid: $foo = default; bar($foo); If it's made valid, i.e. if it acts as a constant, I suspect before long people will be assigning 'default' as yet another alternative to a false/null value, and we'll need yet another concept to resolve that. If it's not made valid, it'll be counter-intuitive as it looks exactly like a constant passed as an argument.

Stan Vass

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to