Re: Assigning void
On Sunday, October 14, 2012 5:09:31 AM UTC-7, Robert Klemme wrote:
My memory might be a bit rusty but the definition of "side effect" that
I learned was that it is a state change not reflected in the result.
That includes IO for example, even if one could argue that the main
effect of System.out.println("foo") is to print "foo\n" on the console.
The definition of "side effect" I have in mind solely deals with a
distinction important in the context of functional languages. A side
effect free expression has some properties which go away when side
effects are introduced (thread safety, stability which has effects on
analysis of behavior etc.). The introductory paragraph on the Wikipedia
page nicely sums this:
http://en.wikipedia.org/wiki/Side_effect_%28computer_science%29
As a term of art, its definition as you state it I cannot dispute.
As a term of common English, a "side" effect is something different from the
stated, explicit purpose.
In medicine they say, "There are no side effects, only effects."
I should have used the term of art, but I was actually saying "side effecty",
not "side effect", even to including the quotes, so I explicitly avoided the
term of art.
I admit I should have used a clearer term, but I was using the term introduced
in the post to which I responded.
My point is that assignment isn't a "side effect" (ordinary English) of
auto-increment, but the intended effect. In the context of why assignment and
its siblings can constitute a statement, but not '?:' or '+', it makes sense.
Thank you for distinguishing this from the term of art.
--
Lew