Montag, 30. November 2009

misunderstanding on casting in go

huch, have needed one day to understand that a function is in really was a cast.
path.Walk(p.String(), pathIter(c), nil);

you can think pathIter(c) is a function. but:

type pathIter chan<- Path

pathIter is a typedefinition. Therefore is pathIter(c) not a function with parameter c, rahter a casting from c (is a Path channel) to pathIter.

Keine Kommentare:

Kommentar veröffentlichen