Re: [go-nuts] [Generics] Concise generics with package level types

2020-06-23 Thread b97tsk
My code shows that returning a generic function might be desirable. The Filter function in my code is as follows: func Filter( type T interface{}, Source Observable(T), )(pred func(T) bool) Operator(T,

[go-nuts] [generics] probably should also try inferring from the use of returned values

2020-06-21 Thread b97tsk
https://go2goplay.golang.org/p/QP2REBLl5f5 The code doesn't compile. But I would like to see it does. (I could make it compiles, of course. But then, it wouldn't look nice.) -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from th

[go-nuts] Re: proposal: disallow implicitly comparing true with value of interface{} in a switch with no value

2018-04-22 Thread b97tsk
Well, that "commonly used" is about the no-condition switch, so it's possible that one may make this kind of mistakes, which I did and was surprised for a moment that the Go compiler lived with it. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group

[go-nuts] proposal: disallow implicitly comparing true with value of interface{} in a switch with no value

2018-04-21 Thread b97tsk
var someInterfaceValue interface{} switch { case someInterfaceValue: // proposal: compile error: non-bool used as condition case someInterfaceValue == true: // OK } Sometimes carefulness is just not enough. One may type a wrong variable as the case condition, or a incomplete condition. Why