domenic / proposal-blocks

Former home of a proposal for a new syntactic construct for serializable blocks of JavaScript code
215 stars 5 forks source link

Variable capture and TypeScript / C# #15

Open benjamingr opened 6 years ago

benjamingr commented 6 years ago

One advantage other languages have over our blöck syntax so far is that they make it very easy to capture variables in the closure passed to the thread/task-factories.

Block syntax can be really useful when coupled with an AST facility in order to implement really cool stuff (like C#'s LINQ).

IIRC there was an interesting discussion about the possibility of implementing this with capture for TypeScript that was shut down for performance reasons. I think it would be really cool if the people involved would weigh in - I think I recall @ahejlsberg

I tried to look for something summarized but couldn't find any.