PHP: A Few Changes To Go
The list found below are a list of items which I would recommend considering for changes to the language. PHP is my preferred language; you will not find me bashing PHP nor hanging out with the Ruby on Rails fanboys who trash talk PHP and compare it to their framework as if it were an equal comparison [except for maybe the lack of a finally block -- which will be corrected in 5.5 (w00t!)]. I do have a list of changes I feel would improve the language overall.
On to the list:
- "$haystack, $needle" or "$needle, $haystack" - pick one and make it consistent across the board. Most of the array functions use $needle, $haystack while string functions like, strstr or strpos are $haystack, $needle
- Pick a function naming method and stick with it - Underscore, all lower-and-crammed-together or camelCased. Examples: in_array, isset, ReflectionParameter::getClass.
- Replace "use
" with "import " for namespaces - I have no real citation or legitimate reason for this I just really don't like the use keyword for namespace/class importing. Use is used for too many thing within PHP plus I have proposed use for use at my next point. Wow, that was a lot of the word use. - Replace "use" with "has" for traits - my biggest complaint is I feel like traits should be included on class declaration. (e.g. class Programmer extends Employee has Coder {...} ). Therein creates a separate problem where it leaves you needing to define Trait preference. I see no reason why these could not be stand-alone statements within the class itself. (e.g.
class Programmer extends Employee [implements PersonInterface] has Coder
{
Coder::getTitle as getJobTitle;
// or if you're hell-bent on the use keyword how-about...
use Coder::getTitle as getJobTitle; // not a bad option
// or just as an interface declaration
public function getJobTitle as Coder::getTitle;
} - Change String concatenation modifier from "." to "+" - The plus-sign is generally used more often with String concatenation (as well as Math addition). Why do we need a separate modifier for String concat. I assume there was a reason this was done for a reason, I know Perl uses the dot for string concatenation.
- Replace back-slash "\" with period "." for namespace separators - why would you want to use your escape modifier to separate namespace paths?
.::. DruiD628 .::.