Templates and Closures

40 views
Skip to first unread message

Steinway Wu

unread,
May 3, 2018, 8:05:28 PM5/3/18
to ats-lang-users
Hi, 

If a put a template function invocation inside a closure function, it seems that the template is resolved at the closure definition time. I know one way to work around this is to use templates all the way, and replace closures with something like `foobar$fwork`. But is there another way of doing so while keeping the closures? Is there something like an anonymous template and corresponding type for it? 


Steinway Wu

unread,
May 3, 2018, 8:26:28 PM5/3/18
to ats-lang-users
Well, I sort of find a way around, that is to write a eta-expanded version that is a template. So the template get's invoked right before it is used to generate a closure. https://glot.io/snippets/f0pf8h25o9

Steinway Wu

unread,
May 3, 2018, 8:31:14 PM5/3/18
to ats-lang-users
I kind of hope there's some sort of `-<tmplate>` besides `-<fun>` and `-<clo>` stuff. Just to mark that this is a template and should be resolved later. 
Reply all
Reply to author
Forward
0 new messages