Should I frequently rely on default values?
For example, in PHP, if you have the following:
<?php
$var .= "Value";
?>
This is perfectly fine – it works. But what if assignment like this to a previously unused variable is later eliminated from the language? (I’m not referring to just general assignment to an unused variable.)
There are countless examples of where the default value of something has changed and so much existing code was then useless.
On the other hand, without defaults, there is a lot of code redundancy.
What is the proper way of dealing with this?
In my opinion, the odds of a language changing drastically once it reaches a certain level of acceptance are pretty low.
To me, each language comes with a (sometimes more or less) unique set of features. Not using those because they just might disappear some day seems shortsighted. Naturally, don’t use esoteric features just for the sake of doing so — make sure you follow usual principles of readability and best practices for your language of choice, but otherwise I see no need to discriminate against particular features.