I came up just now with a new way to implement reversible assignment as in Icon.

The current implementation puts ‘undo’ records on the execution stack. These get used during unwinding. The records contain addresses of variables.

My new method makes every storage cell potentially a stack. In other words, reversible assignment is a particular use of dynamic assignment in the Lisp sense. This method is both simpler and more general.

#programming #programmingLanguages #Icon #Lisp #Scheme

Follow

@chemoelectric Yes, this is a very good technique. It is called "shallow binding" in Lisp, and it was crucial to efficient Lisp implementations when they used dynamic scoping. You may enjoy reading Baker's "Shallow binding makes functional arrays fast" from 01991: dl.acm.org/doi/pdf/10.1145/122

Sign in to participate in the conversation
CleverLibre Social

CleverLibre Social is an inclusive social instance for open discussion, learning, and community.
All cultures welcome.
Hate speech and harassment strictly forbidden.