gnu-arch-users
[Top][All Lists]
Advanced

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

[Gnu-arch-users] Dubious coding practice in xtla


From: Miles Bader
Subject: [Gnu-arch-users] Dubious coding practice in xtla
Date: Mon, 08 Nov 2004 14:32:43 +0900

The xtla code seems to contain quite a few instances where a lambda
expression is quoted using backquote (`) in a non-macro context.  This
means that the compiler doesn't compile these lambda expressions, and
besides the efficiency hit (maybe not a big deal for small code),
results in any macros they call being expanded at run-time -- so if they
use code from the cl package, (eval-when-compile (require 'cl)) is not
sufficient to make them work.  For a concrete example, see
`tla--revisions-parse-list' in xtla.el; it calls tla--cat-log-any with
one of these funny lambdas.

I think that these lambda are a bad practice in the first place, and
should be replaced with proper lambdas that the compiler can see.

I assume the _reason_ for this practice is an attempt to avoid dynamic
binding problems with variables bound in the caller and used by the
lambda expressions, but while this is a real issue, it's easy enough to
work around in vaguely ugly ways (e.g., just  use normal binding and
give the potentially problematic variables names that are unlikely to
conflict; I sometimes prepend the name of the caller for this purpose,
e.g.,

   (defun my-funny-function ()
      ...
      (let ((my-funny-function-var1 ...))
        (use-my-lambda (lambda () ... my-funny-function-var1 ...))))

-Miles
-- 
`Life is a boundless sea of bitterness'




reply via email to

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