Better HN
topnewbestaskshowjobs
Log inSign up

usrbinbash

4,687 karma · joined Dec 4, 2021 (4y ago) · 1,693 submissions

Submissions

comment 4y ago · link · parent

> Unless you care about problem-solving, are fascinated by cool and shiny tech, you will have a hard time as a software engineer.

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

    apt-get install markdown

comment 4y ago · link · parent

> Bram: I have to admit I don’t use many plugins, other than what is included with the distribution (such as matchit and termdebug). When I need something I tend to either make a quick hack or add it to the Vim base. That’s the luxury of being the creator :-).

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

Its also perfectly possible to write broken programs in languages that take care of all memory related issues:

    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

If I have 10 different errors, but the root cause for all of them is that I forgot to do something I should have done (initialize a variable), then the cause is the same across all 10 different errors. If I don't start initializing the variables, then I will continue to have erros (which may or may not be similar to each other), thus making the problem reproduceable.

The errors are not the problem, but the result of the underlying problem.

comment 4y ago · link · parent

The behavior of the program is not reproducible.

The cause of the error is.

comment 4y ago · link · parent

The reproducible thing about this error would be: I forgot to initialize my variables.

comment 4y ago · link · parent

The thing is, C also makes me aware of what is happening, by letting programs fail when I forget about certain things.

This may not be as nice as the compiler yelling at me even before the program is run, but it certainly makes for a much simpler language.

comment 4y ago · link · parent

Or the Blorkchain is forked.

comment 4y ago · link · parent

Support for the artist exists when someone first buys the NFT from the one who minted it. But nothing prevents investors from trading NFTs among each other. How many NFT trades are "artist-to-buyer", how many nft trades are "investor-to-investor"?

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

> But they're not required to tell anyone whether a transaction happened.

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

> no one will be able to verify

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

I can do the same by buying the art from his website transfering the funds to his bank account, using a fraction of the energy, requiring no additional software and no network of nodes to keep some blorkchain alive.

comment 4y ago · link · parent

And what specifically is the idea good for exactly?

comment 4y ago · link · parent

This can be done with existing search operators, e.g.

    my keywords -site:excludefromresult.com

comment 4y ago · link · parent

Not sure about the environment we are talking right now, but vim has 26 letter-,10 number- and 4 special-registers.

Oh, and ofc it can do a lot more with them than just using them as paste-buffers (use in macro, append-to-register, use in scripts, ...)

comment 4y ago · link · parent

If there are any issues, do not hesitate to call our support hotline! We'll be happy to hear from you anytime! (Except days not starting with 'S'. No Service on Weekends.)

comment 4y ago · link · parent

If this was implemented:

    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

A separate `select` with empty `default` is about as simple and clean as it gets. It is easy to read, easy to reason about, and, most importantly, conveys the intention of the code perfectly.

comment 4y ago · link · parent

I agree. The idiomatic thing here would be to simply declare `var err error` in the surrounding scope, especially since this example is a small function where this wouldn't matter.

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

The real usecases where I need deterministic select, are so few that a small performance loss doesn't matter to me.

comment 4y ago · link · parent

Of course there is:

    {
        var err error
        scoped code
    }

comment 4y ago · link · parent

Easily fixed using lexical scopes:

    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

> Not vice versa (the current design).

    select {
       case: <-chan1_whichIWantToCheckFirst
       default:
    }

    select {
       case: <-chan2_whichItreatTheSameAsChan3
       case: 0xFF ->chan3_whichItreatTheSameAsChan2
    }

comment 4y ago · link · parent

> Code / codebase layout is still a very opinionated thing

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

No, I don't, because "an average printer problem" usually translates to

"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

> so if the time comes you are prepared.

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

> Life is short, learn interesting things.

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.

1
424344
57