Hash functions within a context do not see context members
Posted: Thu Mar 25, 2010 1:34 am
I have a solution, but don't fully understand the issue:
I've set up a typehandler/callback using a hash with functions as in
Even though the code above is lexically within a context, the functions defined as members of
the hash do not recognize members of the outer context.
To elaborate, I have to pass the context member DS as the fourth argument to the
(typeHandler "test") lambda and the context member current-DS-index (DSndx)
as the fifth argument.
I can live with that, but I'd welcome comments or whether or not I may be missing
something.
thanks
tim
I've set up a typehandler/callback using a hash with functions as in
Code: Select all
(define typeHandler:typeHandler)
(typeHandler "text"
(fn (fl val ndxs DS DSndx)
(letn((ndx (ndxs 0))(ele (fl ndx))
(attrs(set-attr (list "value" val)(ele 2 1))))
(setf (DS DSndx ndx 2 1) attrs)
DS)))
the hash do not recognize members of the outer context.
To elaborate, I have to pass the context member DS as the fourth argument to the
(typeHandler "test") lambda and the context member current-DS-index (DSndx)
as the fifth argument.
I can live with that, but I'd welcome comments or whether or not I may be missing
something.
thanks
tim