4 ms·
Doesn't golang not support `a < b < c` and chaining of comparisons? I don't see why they make that argument in their specification if it's not already legal Gol
by laddng 6y ago
Doesn't golang not support `a < b < c` and chaining of comparisons? I don't see why they make that argument in their specification if it's not already legal Golang syntax
specification: https://go.googlesource.com/proposal/+/refs/heads/master/design/go2draft-type-parameters.md#why-not-use-the-syntax-like-c_and-java https://go.googlesource.com/proposal/+/refs/heads/master/des...
- dllthomas 6y agoIt's not chaining of comparisons, but rather a multi-valued expression - note the comma.
- yencabulator 6y agoIt does not, so the argument is very much valid. https://play.golang.org/p/NQL1rVp-wVC https://play.golang.org/p/NQL1rVp-wVC -- it's trying to interpret that as (1<2)<3, and the types make no sense for that.
- dllthomas 6y agoWhich argument is valid?
- yencabulator 6y agoThat using angle brackets for generics would unduly complicate Go parsing.
- dllthomas 6y agoThen although I agree, I'm still not sure I follow. > It does not [support chained comparisons], so the argument is very much valid. Was your comment to the effect of "although Go does not support chained comparisons, it is syntactically valid for a comparison operator to be passed the result of a comparison so the issue can still arise"? That's valid, but I would have expected "but" in place of "so". (sorry if it seems I'm picking nits; I'm just trying to understand and explaining my attempts)