Go 2, here we come!

Neia Neutuladh neia at ikeran.org
Sat Dec 1 04:16:10 UTC 2018

On Sat, 01 Dec 2018 03:32:29 +0000, Basile B. wrote:
> On Friday, 30 November 2018 at 02:12:23 UTC, Neia Neutuladh wrote:
>> * There is no function overloading. (Preexisting condition maintained.)
> I wonder how do they do visitors in Go. If it's true that classes are
> not 100% necessary for that at least function overloads are needed to
> dispatch.

It's utterly straightforward:

    type Visitor interface {
        func VisitForeach(v *ForeachStmt)
        func VisitWhile(v *WhileStmt)
        func VisitIf(v *IfStmt)

    func Visit(self *ForeachStmt)(Visitor visitor) {

The visitor pattern is a manual implementation of multiple dispatch, and 
this sort of name mangling is a manual implementation of function 

More information about the Digitalmars-d mailing list