Subject: Re: On side effects From: Paul Prescod <papresco@xxxxxxxxxxxxxxxxxxxxxxxxx> Date: Tue, 17 Jun 1997 12:35:13 -0400 (EDT) |
> That is an interesting way to look at it. However, each > DSSSL function also produces a return value, so the final > output could be considered (the text representation of) the > DSSSL script's return value. I think that that is the correct way to look at it. > What about the setting of inherited characteristics? > Can that be considered a side-effect? No. I would define a side effect as a result of a statement that changes the environment so that code executed *after* the statement may behave differently in some way than if the same code were executed *before* the statement. Manipulating the environment that your "children" inherit does not count. Also, if you read the definition of inherited characteristics carefully, you'll see that what you think is happening is not what is actually happening. The expression specifying the value of a characteristic in a make-expression or style-expression shall not be evaluated immediately; instead the expression shall be associated with the characteristic in the created flow object or style object. The values of the free variables in the expression are remembered and are used when the expression is evaluated, as with a lambda expression. The current node is also remembered and restored for the evaluation of the expression. When the flow object tree has been sufficiently constructed so that the position of a flow object in the flow object tree has been determined, then the expressions specifying the values for the characteristics applicable to that flow object shall be evaluated. So you can think of the final flow object tree as a set of flow objects and associated *expressions* that specify characteristics. You could imagine that the expressions are all evaluted as a post-process step and then the flow object tree is returned. While the DSSSL code itself is executing, it is (theoretically at least) isolated even from its parent context. That's how I understand it anyhow. I personally think that this level of firewalling is maybe a little extreme, and it makes some things tricky or impossible. James discussed "first class modes" as a solution to this not long ago. Paul Prescod DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: On side effects, Vivek Agrawala | Thread | Re: On side effects, James Clark |
Re: On side effects, Paul Prescod | Date | Element content as a string?, Norman Walsh |
Month |