What is an Effect?

Manfred_Nowak svv1999 at hotmail.com
Sun Jan 2 18:07:14 PST 2011


docs:
| Expressions that have no effect, like (x + x), are illegal in
| expression statements. 

But what sorts of effects are meant with this?

In phobos the expressionStatement `cmp("foo", "bar");' is used in 
unittest.d. A comment says:
| Bring in unit test for module by referencing function in it

wtf? Does this mean, that a second expressionStatement
`cmp("foo", "bar");' in unittest.d would be illegal, but not the first, 
because by the second statement the unit test of that module can no more be 
brought in?

Is then in `int x= 42; x= 42;' the assignment of the value `42' to the 
varaible `x' illegal, because `x` already has this value as initialization?

Furthermore: is the result of suppressing an effect nevertheless an effect, 
especially suppressing the default initialization of a variable?

Somehow this reminds me on the time when set theory got the attribute 
"naive".

-manfred  


More information about the Digitalmars-d-learn mailing list