Is it wise to rely on default features of a programming language?

Posted by George Edison on Stack Overflow See other posts from Stack Overflow or by George Edison
Published on 2010-03-17T05:16:30Z Indexed on 2010/03/17 5:21 UTC
Read the original article Hit count: 187

Filed under:
|

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 default values, there is a lot of code redundancy.

What is the proper way of dealing with this?

© Stack Overflow or respective owner

Related posts about language-agnostic

Related posts about default