guile-devel
[Top][All Lists]
Advanced

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

Re: identity


From: Marius Vollmer
Subject: Re: identity
Date: 15 Apr 2001 18:27:27 +0200
User-agent: Gnus/5.0803 (Gnus v5.8.3) Emacs/20.7

Keisuke Nishida <address@hidden> writes:

> We could write a macro `define-duplicate' or something that
> produces the above code.  Should we do that?

Yes, why not.  As you say, `define-duplicate' is too specific, what
about

    (define deprecate
      (let ((issued-warnings (make-hash-table 13)))
        (lambda (msg thunk)
          (cond ((not (hashv-ref issued-warnings msg #f))
                 (display ";;; " (current-error-port))
                 (display msg (current-error-port))
                 (newline (current-error-port))
                 (hashv-set! issued-warnings msg #t)))
          (thunk))))

    (define-macro (with-deprecation msg . body)
      `(deprecate ,msg (lambda () ,@body)))

It would be used like

    (define (id x)
      (with-deprecation
       "`id' is deprecated.  Use `identity' instead."
       (identity x)))



reply via email to

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