anchor.diff:      (loop :for scope :in (scopes backend)
             :thereis (member sym scope))))
   
  -(defgeneric emit-code (backend obj)
  -  (:method (backend obj)
  -      (error "The backend ~A of ~A is not implemented" backend obj)))
  +(defgeneric http-escape (obj sexp)
  +  (:method (obj sexp)
  +    (declare (ignore obj))
  +    (error "Don't know how to escape ~a" sexp))
  +  (:method ((obj att-leaf) sexp)
  +    (declare (ignore obj))
  +    `(encode-for-tt (princ-to-string ,sexp))))
   
  +(defgeneric emit-code (backend obj &key output-p)
  +  (:method (backend obj &key output-p)
  +    (declare (ignore output-p))
  +    (error "The backend ~A of ~A is not implemented" backend obj)))
  +
  +(defmethod emit-code :around (backend (obj att-leaf) &key output-p)
  +      (if (and output-p (auto-escape obj))
  +          (http-escape obj (call-next-method backend obj))
  +          (call-next-method backend obj)))
   ;;; You are to implement the backend specific `emit-code' for `att-output'
   ;; (defmethod emit-code (backend (obj att-output)))
   
  -(defmethod emit-code (backend (obj att-string))
  -  (declare (ignore backend))
  +(defmethod emit-code (backend (obj att-string) &key output-p)
  +  (declare (ignore backend output-p))
     (value obj))
   
  -(defmethod emit-code (backend (obj att-variable))
  +(defmethod http-escape ((obj att-string) sexp)
  +  (declare (ignore obj))
  +  (encode-for-tt sexp))
  +
  +(defmethod emit-code (backend (obj att-variable) &key output-p)
  +  (declare (ignore output-p))
     (let ((sym (varsym obj)))
       (unless (find-from-scope sym backend)
         (push sym (symbols backend)))
       sym))
   
  -(defmethod emit-code (backend (obj att-constant))
  -  (declare (ignore backend))
  +(defmethod http-escape ((obj att-variable) sexp)
  +  (declare (ignore obj))
  +  (if (eq (vartype obj) :string)
  +      `(encode-for-tt ,sexp)
  +      (call-next-method obj sexp)))
  +
  +(defmethod emit-code (backend (obj att-constant) &key output-p)
  +  (declare (ignore backend output-p))
     `',(value obj))
   
  -(defmethod emit-code (backend (obj att-eval))
  -  (declare (ignore backend))
  +(defmethod emit-code (backend (obj att-eval) &key output-p)
  +  (declare (ignore backend output-p))
     (sexp obj))
   
  -(defmethod emit-code (backend (obj att-nil))
  -  (declare (ignore backend obj))
  +(defmethod emit-code (backend (obj att-nil) &key output-p)
  +  (declare (ignore backend obj output-p))
     nil)
   
  -(defmethod emit-code (backend (obj att-progn))
  +(defmethod emit-code (backend (obj att-progn) &key output-p)
     (cons 'progn (mapcar (lambda (node)
  -                            (emit-code backend node))
  +                         ;; :FIXME: mark output-p only the last one
  +                            (emit-code backend node :output-p output-p))
                          (nodes obj))))
   
  -(defmethod emit-code (backend (obj att-if))
  +(defmethod emit-code (backend (obj att-if) &key output-p)
     (with-slots (cond-clause then-clause else-clause) obj
       (list 'if
             (emit-code backend cond-clause)
  -          (emit-code backend then-clause)
  -          (emit-code backend else-clause))))
  +          (emit-code backend then-clause :output-p output-p)
  +          (emit-code backend else-clause :output-p output-p))))
   
  -(defmethod emit-code (backend (obj att-loop))
  +(defmethod emit-code (backend (obj att-loop) &key output-p)
     (with-slots (loop-seq body loop-var) obj
       (let* ((seq (emit-code backend loop-seq))
              (sym (varsym loop-var)))
  
positive.code:          ;; :FIXME: dirty hack
           :for ,sym
           :in ,seq
           :do ,(emit-code backend body)))))
  
negative.code: (in-package :cl-user)
  (defpackage clta.backend
    (:use :cl :clta.util :clta.att)
    (:import-from :html-encode
                  :encode-for-tt)
    (:export :backend
             :make-backend
             :emit-code
             :emit-lambda
             :symbols))
  
  (in-package :clta.backend)
  