4,687 karma · joined Dec 4, 2021 (4y ago) · 1,693 submissions
comment 4y ago · link · parent
Why would I care about, or be fascinated by, how "shiny" something is?
For me, the only relevant attribute of new technology is how useful it is. I don't give a damn if one is a drab-looking CLI tool with only a manpage for docs, and the other has the most gorgeous looking interface I ever laid eyes upon, with a docs-webpage that looks like heavenly choirs sung it into existence...if the former requires 10% less CPU cycles, and can be intergrated into bash scripts, it wins, period.
comment 4y ago · link · parent
This so much. There are amazing plugins out there, but for almost everything I really need, they are overkill. vim comes with so many things included out-of-the-box (just look at netrw), and for the few things I need on top of that, ahcking together a small function bound to a <leader>Key combo which calls an external script is usually enough.
comment 4y ago · link · parent
var ch chan bool
for i := 0; i < 10; i++ {
go func() {
// do something amazing
ch<-true
}()
}
Oops, I just leaked 10 goroutines, because I forgot to `make` the channel instead of declaring it, so its nil and will block indefinitely. Unless the program encounters an complete deadlock of all gorutines, this will not crash anything, and the caller of this code has no way of knowing it happened.Broken code can be written in any language, no matter how much checks & convenience it offers.
comment 4y ago · link · parent
The errors are not the problem, but the result of the underlying problem.
comment 4y ago · link · parent
And if I buy a piece of art the classic way (buyers contract), I can put it in a gallery, or whatever, and "show everyone that I support the artist" that way.
And even without buying something, no Blockchain is required to support artists: people have managed to do so since long before electricity was discovered: https://en.wikipedia.org/wiki/Patronage#Arts
comment 4y ago · link · parent
If they receive a court order, they are required to hand over records.
> Sued about what?
If I buy something from an artist, I am entering a legally binding contract with him. Such contracts can be enforced in court.
Of course, if I just send the artist some money, then he is under no obligation to give me anything, tell anyone about it, or even say "thank you". But that's not what I do when I want to buy a piece of art.
comment 4y ago · link · parent
Except the Credit Card Firm, my bank, and the artists bank. All of which are required, by law, to keep records.
And of course the entire transaction is a simple buyers contract, thus making it legally binding and enforceable.
So if the artist tries to go back on the agreement, he can be sued. If he claims he never received funds, the court orders the banks to hand over the records.
comment 4y ago · link · parent
func foo(a, b int) int {
return a * b
}
At compile time, what is the return type of foo? Answer: Unknown. The compiler has no way of determining if the resulting type will be small or big int. This has to be taken into account not just in foo, but in every function calling foo, and every function that is called with the return of foo as a param.One of the best things about golang, is how little "magic" there is. Everything that happens is immediately obvious from the code. An int that is upgraded to a completely different type when it reaches certain values, goes directly counter to that; it would be hidden behaviour, not immediately obvious from the code.
Should golang have a builtin arbitrary sized integer type? Maybe. Using math/big can become cumbersome. But a much better solution would be to introduce a new builtin type like `num`
comment 4y ago · link · parent
But "idiomatic" always takes a backseat compared to technical necessity. If there is a requirement, for some reason, to limit the scope of `err` and still allow `result` to be changed in the if's pre-assignment, then this is the way to do it.
comment 4y ago · link · parent
func doThing() string {
result := "OK"
{
var err error
if result, err = somethingElse(); err != nil {
return "ERROR"
}
}
return result
}
`err` is introduced in the lexical scope, `result` isn't so it still refers to the string from the surrounding scope. `err` does not pollute the surrounding scope.You can also try the complete version here: https://go.dev/play/p/kDEB11YdvSs
comment 4y ago · link · parent
And will remain so, because there simply is no silver bullet. Does it sometimes make sense to have a "cmd" directory? Absolutely. Does it sometimes make sense to have every subcomponent live its own package? Yes.
Does it always make sense? No.
comment 4y ago · link · parent
"I bought these ink/toner cartridges from one website, and the sledge they go into from another one, and I managed to wedge them into the printer somehow even though now the hatch no longer closes properly and it makes funny noises when I start it, but the light is slighly more orange than last time, so that's a good sign, but it cannot fetch paper from the tray now, could you have a look at it? Because you're so good with the tech stuff..."
Sorry, but my proficiency in software engineering doesn't exactly qualify me for handling things like hatches, hinges, tiny gears, levers, springs and plastic boxes that don't fit well together.
comment 4y ago · link · parent
The thing is, how many times did "the time come"?
15 years ago, I was told I need to learn all about design patterns, and for 10 years after that, I heard about a new OOP-design philosophy almost every month.
Then it turns out wrapping everything into design patterns makes the code harder to read and we are right back to procedural programming.
7 years ago, friends told me I need to learn pure functional programming NOW, because it's the future of programming.
Well, long story short, I still don't know what a Monad is, and the code is still procedural.
comment 4y ago · link · parent
The interesting thing about software engineering to me, is not the features of the languages, its the programs I get to write in them.
I don't learn programming languages because I want to know the latest concepts in language design, I learn them so I can write interesting software.