by voidlogic · 9y ago · 0 comments
But something struck me, the low level execution flow was much much more intuitive. I think this might be an example how simple syntactic sugar can make code much harder to reason about intuitively. I do write a lot of Go so maybe its just that... you tell me!
A), I don't view this as lower level, just more verbose and explicit.
B), the logic is the same, but it's harder to read the operations—not knowing go, `await` makes a lot more sense than `<-`.
>I don't view this as lower level, just more verbose and explicit.
Well in this case, aren't these the same? The Go flow shows the explicit spawning of a (go/co)routine and the reading and wring to a thread safe queue. The C# abstracts this so the Go is closer to what is actually happening (ie low level). I should point out, you say more verbose, but there isn't much, if any, of a line count hit here for Go compared to C#.
>but it's harder to read the operations—not knowing go, `await` makes a lot more sense than `<-`.
Fair point, but if you swap <- for await I'd think the Go is more clear for people equally unfamiliar with Go and if you are learning Go <- is a core operator you will learn early.