Re: DSSSL Design Question

Subject: Re: DSSSL Design Question
From: "James Clark" <jjc@xxxxxxxxxx>
Date: Wed, 25 Jun 1997 16:30:02 +0700
> Ok, I am convinced.  Can we also define first-class modes at the
> top level, just like other processing modes, but with parameters?
> 
> The following is based on James' earlier example:
> 
> (first-class-mode mode-fff (x y)
>    (element BAR
>       (if x
>         (make simple-page-sequence)
>         (make scroll)))
>    (element BAZ
>       (literal y)) )
> 
> (element FOO
>    (let ((x (compute-some-info-about-foo))
>          (y (compute-some-other-info-about-foo)) )
>      (with-first-class-mode mode-fff (x y)
>         (process-children)) ))

You can just do

(define (mode-fff x y)
  (mode
    (element BAR
      (if x
        (make simple-page-sequence)
        (make scroll)))
    (element BAZ
       (literal y))))

 (element FOO
    (call-with-mode
      (mode-fff (compute-some-info-about-foo)
                   (compute-some-other-info-about-foo))
      process-children)))

Note that there's just one new syntactic form (mode): call-with-mode is a
procedure.

James



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


Current Thread