RE: Questions about DSSSL evaluation order.

Subject: RE: Questions about DSSSL evaluation order.
From: "Frank A. Christoph" <christo@xxxxxxxxxxxxxxxxxx>
Date: Wed, 4 Feb 1998 14:59:13 +0900
As we were discussing earlier, because DSSSL is side effect-free, the
evaluation order ought to be irrelevant unless the program in question
involves recursion, and this one does not.  (If you can find a
counterexample to this, I would be interested to hear it.)

But anyway your second code listing is not right.  First, though, let's get
some terminology correct.  In DSSSL and Scheme, a program gets "evaluated"
(or "reduced"), not "expanded".  Second, a "closure" is the result of
evaluating a function.  I think what you mean is an "application" or, more
generally, a "redex" or, more generally yet, a "procedure call".

Now, (process-children) is an argument to $lowtitlewithsosofo$, so since
DSSSL is call-by-value, it will get evaluated before it is substituted into
the function body.  Since the result of (process-children) depends on the
grove and the rest of the style specification, you can't write out the
evaluated form without knowing that information.  But even then, since
sosofos have no external representation, it wouldn't be a valid DSSSL
program.  (You could perhaps expand --- this time I do mean "expand" --- the
result into a make-expression, though, yielding an equivalent program.)

Furthermore, a procedure call is evaluated by evaluating the arguments and
operator, then substituting the arguments into the function body, and then
evaluating the function body.  So the result of ($lowtitle$ 2) is a value,
more specifically a sosofo.

When a rule is activated, it evaluates its construct expression, which
yields a sosofo, so it doesn't make much sense to ask what the program will
look like _before_ the construction rule is evaluated.  The relevant parts
of the program fragment might look something like this _after_ the
construction rule is evaluated, though.

(element (SEGMENTEDLIST TITLE) #sosofo#)

where #sosofo# is some abstract representation of a sosofo.  (It's not valid
DSSSL.)

You can find descriptions of the evaluation rules in the expression language
part of the standard; the rules for processing element rules and
make-expressions is in the style language part of the standard.
Incidentally, maybe you are already aware of it, but JIS is planning to
adopt DSSSL and has made what is essentially a Japanese translation of the
DSSSL standard available.  I don't have the URL at hand right now, but if
you mail me I will dig it up for you.

--FC

>I have some questions about DSSSL procedure-definition and evaluation
order.
>
>The DocBook Style Sheet has following an element-construction rule and
>two procedure-definitions.
>
>  (element (SEGMENTEDLIST TITLE) ($lowtitle$ 2))
>
>  (define ($lowtitlewithsosofo$ tlevel sosofo)
>    (let ((hs (HSIZE (- 3 tlevel))))
>      (make paragraph
>   font-family-name: %title-font-family%
>   font-weight: 'bold
>   font-size: hs
>   line-spacing: (* hs %line-spacing-factor%)
>   space-before: (* hs %head-before-factor%)
>   space-after: (* hs %head-after-factor%)
>   start-indent: %body-start-indent%
>   quadding: 'start
>   keep-with-next?: #t
>   sosofo)))
>
>  (define ($lowtitle$ tlevel)
>    ($lowtitlewithsosofo$ tlevel (process-children)))
>
>Before the element-construction rule (for SEGMENTEDLIST TITLE) is
evaluated,
>Must be this construct-expression expanded as following?
>
>(element (SEGMENTEDLIST TITLE)
>  (let ((hs (HSIZE (- 3 2))))
>    (make paragraph
>   font-family-name: %title-font-family%
>   font-weight: 'bold
>   font-size: hs
>   line-spacing: (* hs %line-spacing-factor%)
>   space-before: (* hs %head-before-factor%)
>   space-after: (* hs %head-after-factor%)
>   start-indent: %body-start-indent%
>   quadding: 'start
>   keep-with-next?: #t
>   (process-children)))))
>
>And, Where can I found such definition (i.e. after all of nested closures
are
>expanded construct-expression is evaluated) in DSSSL standard ?



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


Current Thread
  • Questions about DSSSL evaluation order.
    • KAZUMI Saito - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id XAA29603Tue, 3 Feb 1998 23:10:29 -0500 (EST)
      • <Possible follow-ups>
      • Frank A. Christoph - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id AAA01083Wed, 4 Feb 1998 00:52:56 -0500 (EST) <=
        • Henry S. Thompson - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id GAA08522Wed, 4 Feb 1998 06:03:52 -0500 (EST)