Go Isn't C
iottmco.wordpress.com
iottmco.wordpress.com
your code:
v := eval(e)
switch v.(type) {
case cons:
fmt.Printf("<cons>\n")
case sym:
fmt.Printf("<sym : %s>\n", string(v.(sym)))
case float64:
fmt.Printf("%f\n", v.(float64))
case string:
fmt.Printf("\"%s\"\n", v.(string))
default:
fmt.Printf("nil\n")
}
now without the redundant type assertions. switch v := eval(e).(type) {
case cons:
fmt.Printf("<cons>\n")
case sym:
fmt.Printf("<sym : %s>\n", string(v))
case float64:
fmt.Printf("%f\n", v)
case string:
fmt.Printf("\"%s\"\n", v)
default:
fmt.Printf("nil\n")
}
It seems like your problem isn't that you don't "trust your tools" it's that you don't known them. That's fine. I don't really know half of mine half as well as I should. Programmers not understanding their tools is a long studied problem with no good solution.I'm talking about a distinct problem from programmers not knowing their tools - programmers who do know and understand their tools quite well, but decide, for whatever horrible reason, that those tools are "quite good enough", and insist on going from scratch. Sometimes justified, and usually not - and it can lead to a great deal of harm in the way of unmaintainable bloat.
case float64:
fmt.Printf("%f\n", v.(float64))
which can be simplified to case float64:
fmt.Printf("%f\n", v) Programmers not understanding their tools is a long
studied problem with no good solution.
As is the problem of programmers not trusting their tools. I think they're both still worth writing about every now and then. In fact, that might be the closest thing to a solution we have. Hopefully every time you bring it up, a few more people get it.One of my favorite uses of NIH is to replace something like, oh I don't know -- SQL -- with another query language "to make it easier to write queries". Right. Because SQL is so baffling, that we need to replace it with another syntax. And what will that syntax do? Convert a statement to SQL.
I use NIH as a filter in interviewing. If someone cannot appreciate NIH as a productivity killer, I know they generally won't be a good fit for my team.
I feel oppositely. I feel more like I too often use a debugger when I should be setting up a robust logging system. Debuggers are often "a temporary solution to permanent problem"...
Contrary to the author's comments, it makes perfect sense for every system to have its own logging system.
1) It isn't at all hard to create so it doesn't cost you. 2) Every system is a little different in the levels of logging that are use as well as the details that it wants to include or exclude.
I'm using Qt currently and their qDebug() statement just sucks for my purposes - there's arbitrary limit on the number of debug outputs allowed. Why? Why? ...
The question is - should other people modify the logging code? If it's just a part of your scaffolding, it might not be a huge issue.
It then becomes a trade-off between productivity, and technical debt. Prototypes don't need to be sustainable, they just need to be done. You'll either re-write them, or they will work forever (by some miracle) without maintenance, or most likely end up in the big bit bucket in /dev/null
Had me going until there. Rolling your own parser to avoid yacc sounds like an absolutely splendid idea. Techniques like parsing expression grammars are worth some mild sense of "NIH", and in any case there are plenty of PEG libraries to take advantage of as well.
Nothing earth shattering or really related to go or c specifically...rather disappointing.
(Sorry, couldn't resist.)
It's not sense of humor that's penalized, though. It's comments without content. (Generally.)
Am I the only one who thinks these titles are too often unoriginal, suggestive and often conclusive? And sometimes the conclusions in the title are not even supported in the article.
It's not just HN. It's everywhere on the web.
I just don't get it.
Then again, I've gotten away with humor many times. Actually, some of my highest karma comments are humorous in nature.
Examples:
So the take-home message is that HN isn't Reddit. One should be a witty smart-alec rather than a funny wise-ass.