opImplicitCast/opImplicitCastFrom

bearophile bearophileHUGS at lycos.com
Thu Oct 30 13:02:38 PDT 2008


Andrei Alexandrescu:
> Why worry about syntax?

Because from past experience I have seen that having a suitable syntax helps focus the mind a little. While when I discuss a feature in "abstract" most people just ignore what I have written.
And because the absence/presence of a natural-looking syntax is often a sign that the semantics of something is muddy/clear.


> The nice thing 
> about those is that they allow you to specify infinite behavioral 
> variations via policies. For example, you'd want to choose the behavior 
> on overflow to be e.g. throwing, unchecked, or wraparound:

It's also useful to follow the 80/20 rule, to avoid making the semantics of this overly complex, increasing the complexity to give the programmer the possibility of specifying cases that aren't common. That's why the lambdas of C++ have an horrible design, they are over-generalized, while 95% of the times people need just a basic lambda (and in the other 5% of the cases the user can write a normal function/class manually).
The "wraparound" seems not much useful to me.

Bye,
bearophile



More information about the Digitalmars-d mailing list