News for hackers. Stuff that matters.
Re:The visitor pattern is essentially the same thing as Chur... by Twisol on Thursday February 04, 2021 @06:34AM (#26024507)
> Now, in order for it to work, a language has to support closures, not just functions.

Objects are a reasonable stand-in for closures. Pass in the first batch of arguments to the constructor, and store them as fields. Access them from the method (which plays the role of the "returned" closure) when it's called later.

(This is effectively the same as "closure conversion" in the literature, but we're taking advantage of the implicit-receiver convention to hide the parameter by which we're passing the prepared fields.)

There are no comments on this comment yet.