Passing impl Foo as an argument is smell in my opinion, and actually performs worse (due to dynamic dispatch at runtime). Passing a T: Foo instead allows the compiler to monomorphise the function. It’s also cleaner to do this when you have multiple constraints on the T and not just a single Foo.
I had a great time with this! It was this combination of factors that finally got a game out the door:
I still have an item on my bucket list to write a game in Fennel and submit it to the jam. Maybe next year!
It was surprisingly straight-forward to do via TIC-80.
Passing
impl Foo
as an argument is smell in my opinion, and actually performs worse (due to dynamic dispatch at runtime). Passing aT: Foo
instead allows the compiler to monomorphise the function. It’s also cleaner to do this when you have multiple constraints on theT
and not just a singleFoo
.You are thinking about
dyn Foo
, notimpl Foo
Note that there is currently an open patch to Guile Scheme to improve the API of SRFI-171 (Transducers).
https://lists.gnu.org/archive/html/guile-devel/2022-12/msg00030.html