Hi Jon,

> I have noticed that frequent use of ‘setq’ has been questioned recently on
> this list. In my convConcat.l script there are quite a few setq’s that 
> possibly
> could have been coded in a better way. Let me know if you spot some obvious
> candidates.

Basically there is nothing bad about 'setq'.

It is just problematic if you use it to modify not-locally-bound symbols (the
term is "free variables") without them being clearly meant as global variables
(by convention with a leading '*'), or from functions meant as local to other
functions (by convention with a leading '_').

'lint' should complain in such cases.

In case of convConcat.l, you set some globals in the beginning, and local
variables like 'Head', 'Tail', 'Val' and 'C'. Looks all good.


If I lint the code, I just get a single warning

   : (lintAll)
   -> ((convLink (bnd @Props @After @X @Before)))

which means "please bind these four symbols" in function 'convLink'.

This is because 'match' also sets values. You can fix this by calling 'use' on
them:

   (de convLink (F Chunk)
      # First checking special case <a name=">foo">
      (use (@Props @After @X @Before)
         (if (match '(@Before < a " " n a m e = "\"" > @X "\"" > @After) Chunk)

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to