chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-hackers] [PATCH] Fix for #989 and hopefully #877 too


From: Jörg F. Wittenberger
Subject: Re: [Chicken-hackers] [PATCH] Fix for #989 and hopefully #877 too
Date: Wed, 06 Nov 2013 20:50:05 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5

Am 06.11.2013 20:38, schrieb Peter Bex:
On Wed, Nov 06, 2013 at 08:34:38PM +0100, "Jörg F. Wittenberger" wrote:
At least we're now within the scope of a letrec ;-)
I must say that's a huge relief :)


I'm not that sure about the relief. For the fun of it (no more, except that somebody is actually able to spot the problem) I'll paste it below.

Note that the second parameter to the procedure "rules->process" turned out to be the #<unspecified> value.
(There are only two calls to it.)

This second parameter is always "vars", which in turn is the third parameter of "make-mode-choice" below.

To sum up: so far *I* can not see how whatever changes to the semantics of letrec vs. letrec* should be able to effect the passing of that "vars" value at all. (No matter how wrong the letrec might be now - or not.)

(define (make-mode-choice root-node templates vars proc-chain)

  (letrec

      ((modi (xthe (list-of (pair string procedure)) '()))

       (named (fold (make-xslt-named-template-register vars proc-chain)

            (make-string-table) templates))

       (recurse

    (lambda (mode)

      (if (string? mode)

          (let ((e (hash-table-ref/default named mode #f)))

        (or e

            (raise-message "template named \"~a\" not found" mode)))

          (let ((e (assq mode modi)))

        (cdr (or e

             (raise-message "mode ~a not defined" mode)

             ;; Default not reached:

             (car modi))))))))

    ;; Somehow it should be possible get that done without an

    ;; assignment, but I did not manage.

    (set! modi

      (map

       (lambda (mode)

         (cons

          (car mode)

          (if (string? (car mode)) ; call a named template

          (lambda-process

           "named template" (proc-chain)

           (transform

            ;; self-node: nl

            sosofos: (%children (cdr mode))

            variables: vars

            ;; war (xslt-process-node-list proc-chain) -- falsch

;            process: proc-chain

            continue: recurse))

          (let ((optimized-templates (vector-ref (cdr mode) 0))

            (templates (vector-ref (cdr mode) 1)))

            (if (null? optimized-templates)

            (rules->process

             recurse vars

             (make-general-rules templates proc-chain))

            (rules->process

             recurse vars

             (make-xslt-optimized-rules

              root-node optimized-templates proc-chain

              (make-general-rules templates proc-chain))))))))

       (fold register-xslt-match-template

         empty-mode-data-list

         templates)))

    recurse))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]