Re: On side effects

Subject: Re: On side effects
From: Paul Prescod <papresco@xxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 18 Jun 1997 12:27:07 -0400
James Clark wrote:
> >While the DSSSL code itself is executing, it is 
> > (theoretically at least) isolated even from its parent context. 
> >
> > I personally think that this level of firewalling is maybe a little
> > extreme,
> 
> But given that inheritance happens in the flow object tree how can it be
> otherwise?  Consider
> 
> (let ((x (make sequence font-size: (+ (inherited-font-size) 2pt) (literal
> "foo"))))
>   (sosofo-append
>      (make paragraph font-size: 10pt x)
>      (make paragraph font-size: 12pt x)))
> 
> The make sequence expression gets evaluated once, but the expression
> specifying the font-size characteristic has to get evaluated twice with a
> different result in each case.

I was thinking more of its execution context than its flow object tree
context, but your email helped me to separate those more clearly in my
mind. "First Class Modes" provide a mechanism for creating an execution
context that can pass down data. It feels vaguely like there could also
be some way to paramaterize construction rules that would not require a
whole new set of construction rules in the first class mode. Typically
one passes state down a Scheme procedure call-tree in parameters. Maybe
something like this:

(process-children nesting-depth: 5 really-complex-font-choice:
*really-complex-font-choice*)

Now that I think about it, I suppose you could emulate that with
first-class modes.

(define (my-process-children #!key nesting-depth
really-complex-font-choice)
    (with-mode 
	(first-class-mode 
	    (element ...)))))

My big concern about modes (first class or otherwise) is that they don't
seem to nest the way I would expect them to:

(element foo (...) ) 

(mode bar
    (element foo (...))
    (element qutz (with-mode baz (process-matching-children "baz"))))

(mode baz
    (element baz (process-matching-children "foo")) 

If I call (with-mode bar) which calls (with-mode baz) I want the
definition for "foo" from "bar". I want construction-rules to overwrite
each other in the "environment" according to nesting. This problem will
become more severe with first-class modes because you will make a small
mode just to pass some information down the tree, but will find that it
changes the construction-rules that get called.

 Paul Prescod

 DSSSList info and archive:  http://www.mulberrytech.com/dsssl/dssslist


Current Thread