Better HN
topnewbestaskshowjobs
Log inSign up

elvlysh

7 karma · joined Mar 27, 2025 (1y ago) · 16 submissions

Submissions

comment 1y ago · link · parent

> You may as well use exception handlers if you're going to go there.

I didn't know about this trick, thanks for sharing.

comment 1y ago · link · parent

Yes, and all are equally offensive to the average Go hater, all of them have NULL, and all of them have terrible error handling. It's not "argument from popularity", it's "argument from success". Some things succeed. Other things don't. It would be worthwhile for you to investigate why things succeed despite all the hangups you have with their flaws instead of lamenting them because the things you like aren't succeeding.

comment 1y ago · link · parent

>Abstractions make large systems easier to understand, not harder.

I raise you AbstractSingletonFactoryProxyBean.

comment 1y ago · link · parent

You can do something like this:

   type errHandler struct {
      err error
   }

   func (eh *errHandler) getFirst() string {
      // stuff
      if err { eh.err = err }
      return result
   }

   func (eh *errHandler) doWith(input string) string {
      if eh.err != nil {
         return ""
      }
      //stuff
      if err { eh.err = err }
      return result
   }

   func (eh *errHandler) doFinally(input string) string {
      if eh.err != nil {
         return ""
      }
      //stuff
      if err { eh.err = err }
      return result
   }

   func (eh *errHandler) Err() error {
      return eh.err
   }

   func main() {
      eh := &errHandler{}
 
      first := eh.getFirst()
      second := eh.doWith(first)
      final := eh.doFinally(second)

      if err := eh.Err(); err != nil {
         panic(err)
      }
   }

comment 1y ago · link · parent

How come a reinvention of a 30 year old wheel is more successful and popular than pretty much every language that attempted to evolve the wheel during that time?

"It's because people who like Go are stupid and companies need stupid people to write stupid code" may have made you feel smug and secure during the last 15 years, but what about the next 15? Or the 15 after that? Are you still going to be complaining about the stupid 70 year old wheel made by that dumb guy Pike that you hate so much?

comment 1y ago · link · parent

Pretty much every reputable computer scientist has been saying for the last 70 years that the most important thing in the entire world is simplicity and ease of understanding.

comment 1y ago · link · parent

Compactness is in the eye of your beholder. You might have the eyes of a spider, but I have the eyes of a large orc.

comment 1y ago · link · parent

"bad" ideas? Really? Are you so sure? Are your ideas really any better? What language have you made that has seen more success than Go? Clearly if they did such a bad job it would be easy for you to fix it all up and tell everyone about it.

comment 1y ago · link · parent

> Do this call

value, err := function()

> if there is an error return it

if err != nil { return err }

> otherwise give me the value

// rest of the code goes here

comment 1y ago · link · parent

So you would prefer to write match result => error instead of if err != nil? Excuse me for not being convinced that this isn't just fussing over syntax.

comment 1y ago · link · parent

More like you ignore the existing work that Go itself is built on.

comment 1y ago · link · parent

More than one person designed the language than Pike, you know. He's retired. Maybe you can find another member of the devteam to pick on?

comment 1y ago · link · parent

I don't really agree. I find Iota perfectly serviceable.