Re: [go-nuts] Pattern Syntax in Golang

2019-06-05 Thread Michael Jones
Nadim, from what you have written I sense that you appreciate (or will enjoy learning about) the style of programming that emerged with SNOBOL some time ago. The notion of programming not just by saying "do this, then this, then..." but at a higher and more conceptual level of *matching* *situation

Re: [go-nuts] Pattern Syntax in Golang

2019-06-05 Thread Nadim Kobeissi
Hello, and thank you for your response. I never intended to suggest that adding pattern matching would allow Go computational capabilities that it did not previously have. I agree that switch can be wielded to achieve the same logic in a syntax and structures that roughly resembles my suggestion.

Re: [go-nuts] Pattern Syntax in Golang

2019-06-05 Thread Ian Lance Taylor
On Tue, Jun 4, 2019 at 10:22 PM Nadim Kobeissi wrote: > > Two more examples to show off some more cool ways match could be useful. > Here, I just demonstrate how we can have logic inside matches thanks to > anonymous functions: > > result = match getDayAndDate() { > "tuesday", _: "wow looks

Re: [go-nuts] Pattern Syntax in Golang

2019-06-04 Thread Nadim Kobeissi
Two more examples to show off some more cool ways match could be useful. Here, I just demonstrate how we can have logic inside matches thanks to anonymous functions: result = match getDayAndDate() { "tuesday", _: "wow looks like it's tuesday", _, 5: (func() string { if isItWednesd