Re: [go-nuts] Re: Ternary ... again

2018-08-17 Thread 'Kean Ho Chew' via golang-nuts
On Friday, August 17, 2018 at 5:56:05 PM UTC+8, Liam wrote: > > People have a wide range of perceptive and cognitive abilities. People > also have difficulty imagining the very different abilities that others > possess. > > I find constant vertical scanning and scrolling to be distracting and t

Re: [go-nuts] Re: Ternary ... again

2018-08-16 Thread 'Kean Ho Chew' via golang-nuts
On Friday, August 17, 2018 at 8:53:15 AM UTC+8, Liam wrote: > > I find that one-concept-per-line, yielding more compact functions, is > easier to focus on, as it reduces vertical eye scanning and scrolling. > > A single-line if stmnt and my switch example demonstrate > one-concept-per-line. > > T

Re: [go-nuts] Ternary ... again

2018-08-16 Thread 'Kean Ho Chew' via golang-nuts
> > The first is ternaries. What if only simple, non-nested ternaries were > supported? For example, color := temperature > 100 ? “red” : “blue”. This > seems so much more clear than the map[bool]:string trick that some have > proposed. Writing this with an if statement takes either 4 or 6 line

Re: [go-nuts] Re: RFC: Blog post: How to not use an HTTP router

2017-12-19 Thread 'Kean Ho Chew' via golang-nuts
> > Yet, you still need to work with pattern such as: > */Articles/{aid}/Comments/{cid}/likes*, which AFAIK, httprouter can't > handle (correct me if I'm wrong; one of my research point leads to here: > https://husobee.github.io/golang/url-router/2015/06/15/why-do-all-golang-url-routers-suck.h

Re: [go-nuts] Re: RFC: Blog post: How to not use an HTTP router

2017-12-19 Thread 'Kean Ho Chew' via golang-nuts
*The basic arguments, again, are a) Having a Router doesn't actually save you code in a significant way, because you are replacing a conditional with a function call and b) instead you are pulling a whole lot of unnecessary code into your program, that implements a DSL to express the routing

Re: [go-nuts] Re: RFC: Blog post: How to not use an HTTP router

2017-12-18 Thread 'Kean Ho Chew' via golang-nuts
> > > I disagree. I am making the argument that the concept of a router is > inherently broken. Writing your own router doesn't improve on that. Don't > write a router, write routing logic. > > At some point you might have to agree with me. By abstracting the routing logic into a library to 'go

[go-nuts] Re: RFC: Blog post: How to not use an HTTP router

2017-12-18 Thread 'Kean Ho Chew' via golang-nuts
IMO, this article itself is indeed indicating there is an important feature not fulfilled by the standard package. It is asking people to write their own routers indirectly, thus, leading to the current situation (e.g: more routers). There is a much better guide here: https://stackoverflow.com