Constant relationships between non-constant objects
bearophile via Digitalmars-d
digitalmars-d at puremagic.com
Wed Jun 18 00:14:30 PDT 2014
Sebastian Unger:
> Just think bugs like
> if (a = 3) ...
> instead of
> if (a == 3) ...
> Not sure if this particular bug is possible in D, but that's
> beside the point.
This bug is hard to do in D:
void main() {
int a = 3;
if (a = 3) {}
}
test.d(3,14): Error: assignment cannot be used as a condition,
perhaps == was meant?
> I'd stronly argue for D getting that feature. If I can't
> express some of the most basic constructs in OOD in D, it
> really falls more into the category of a toy language for me.
> Now, in the 19 years as a software developer,
When you are used to language A with feature X and you switch to
language B that lacks X, a very common programmer's fallacy is to
think you can't live with X or B is a toy language because it
lacks X. In reality languages are not a collection of features,
they are more like an ecology of features, where each part is
designed keeping in account the presence of most of the other
parts. So usually language B has features or tools that make up
for the lack of X, or X was too much costly to add to B. So when
you switch to use language B you need to adapt yourself and work
around the lack of X using what B offers.
Bye,
bearophile
More information about the Digitalmars-d
mailing list