Functions may leak information about names(!) of local variables.
Subject: Functions may leak information about names(!) of local variables.
From: van Nek
Date: Thu, 28 Dec 2006 17:00:44 +0100
(%i1) g(s):=block([t],local(t), t[4]:subvar(s,4), t[4])$
(%i2) t[n]:=n^3$
(%i3) g(t);
(%o3) t
4
(%i4) g(s):=block([t],t[4]:subvar(s,4), t[4])$
(%i5) g(t);
(%o5) 64
Hi Michel,
the use of 'local' makes the difference here. As far as I understand (see doc of 'local'),
local(t) causes that all global information about t is forgotten and the substituted expression
subvar(t,4) is evaluated just as t[4], nothing more.
Volker van Nek