News for hackers. Stuff that matters.
Re:The visitor pattern is essentially the same thing as Chur... by chombier on Thursday February 04, 2021 @11:06AM (#26026591)
1. each case of the pattern matching is encoded by a lambda (the ones passed to "shape" in function "area")

2. each possible shape instance is a function that will accept these case lambdas, picking the one corresponding to it and passing its constructor arguments to it

3. the constructors ("Circle", "Rectangle") create the shape instances

There are no comments on this comment yet.