On 11/3/2014 4:49 PM, H. S. Teoh via Digitalmars-d wrote:
Don't add a warning, just make it outright illegal to assign signed to unsigned and vice versa unless an explicit cast is given.
This has been proposed before.
There are no "unfortunate", "ugly", or "arbitrary" consequences here. Much like the recent (or not-so-recent) change of prohibiting implicit conversion of a pointer to bool in an if-condition, or the requirement of a default case in a non-final switch, or so many other improvements in D over C/C++, such a change will (1) make problematic code an error so that it will get fixed, and (2) force users to rewrite non-problematic code to be more self-documenting so that their intent is clearer. Sounds like a win-win situation to me.
Should be careful with analogies like that. Each case is different. Your proposal (which has been proposed many times before) requires, as you say, explicit casting. You are glossing over and dismissing the problems with explicit casts, and the problems with overloading, etc.