On Fri, 29 Mar 2013 10:22:43 -0400, Timon Gehr <[email protected]> wrote:
On 03/29/2013 03:20 PM, Timon Gehr wrote:
On 03/29/2013 03:03 PM, Steven Schveighoffer wrote:
...
3. I HATE "safe" cast conversions. If you want to make a conversion,
use a method/property. I don't even know why D allows overloading
casting. Casts are way too blunt for this.
...
The only conceivable reason is opCast!bool, eg. for use in if
conditions.
(In case this is not clear, a conversion method cannot really do the job
satisfactorily because of the if(auto x = foo()) construct.)
That one I don't mind, because it is an implicit cast. I think that
feature actually would be better served by opBool or opTest or something
like that.
It's the explicit casts which are horrible. Cast makes type-checking go
away to some degree, it's like requiring a sledge hammer to put in finish
nails. Plus the syntax is awkward.
-Steve