Linked by Thom Holwerda on Sat 19th Aug 2006 16:11 UTC
Microsoft MSDN's Channel 9 has two videos in their 'Going Deep' series which dive, well, deeper into Singularity, the operating system in development at Microsoft's research department. The first of the two is about, among other things, Software Isolated Processes (SIPs). The second of the two actually shows Singularity in action.
Thread beginning with comment 153976
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE[3]: R&D
by grayrest on Sat 19th Aug 2006 19:54 UTC in reply to "RE[2]: R&D"
grayrest
Member since:
2006-03-14

I've read about 'side-effects' in imperative languages before (possibly in your posts), but what is exactly meant by them?

A side-effect is something that changes the state of the system. Simple example (javascript):

pure_functional = function(a){return a+2;}

side_effect = function(a){a += 2; return a;}

In the first case, you get back a+2 but a remains the same, in the second you get back the same thing but the value of a is changed.

This is a rather trivial example, but more significant things like I/O are also side effects. Wikipedia has a rather extensive treatment of functional programming, side effects, etc if you're interested.

Reply Parent Score: 3

RE[4]: R&D
by postmodern on Sat 19th Aug 2006 20:40 in reply to "RE[3]: R&D"
postmodern Member since:
2006-01-27

That's not so much a side-effect of imperative languages, but more how a language handles and passing data. How about another example?

Reply Parent Score: 1

RE[5]: R&D
by grayrest on Sat 19th Aug 2006 22:08 in reply to "RE[4]: R&D"
grayrest Member since:
2006-03-14

How about another example?

The point wasn't to distinguish between pass-by-reference and pass-by-value, in fact, the entire reason that distinction is necessary is because the language has side effects.

Consider the snippet:

x = 1
x + 2
print x
x = 2
print x

The output of the first print statement is 1, even though it comes after an addition operation on x, the value is 1 because addition is an operation with no side effects.

Now consider the second assignment operation. Whatever value was previously in x is now gone, the value of x is now 2. This is called a destructive update. The state of x is modified so that future references to x (the print statement) will now get the value 2.

In a language without side effects, any past or future reference to x will always retrieve the same value. Similarly, functions will always return the same value given the same inputs, this is the concept of referential transparency.

Reply Parent Score: 2