coalton-lang / coalton

Coalton is an efficient, statically typed functional programming language that supercharges Common Lisp.
https://coalton-lang.github.io/
MIT License
1.12k stars 67 forks source link

Remove `traverse` `action`s' explicit function reference passing #1192

Closed amorphedstar closed 1 month ago

amorphedstar commented 1 month ago

Currently, a recursive function object traverse must be provided as an argument for actions whenever when is :traverse. https://github.com/coalton-lang/coalton/blob/main/src/codegen/traverse.lisp#L57-L61 The recursive object reference never changes over a traversal, so it could be nice to fix the reference to something not explicitly passed, using something like dynamic extent.

stylewarning commented 1 month ago

I would say we want to use a special variable (e.g., a (defvar *foo*)) which is bound for the dynamic extent of the call