frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

LLMs are powerful, but enterprises are deterministic by nature

3•prateekdalal•1h ago•0 comments

Ask HN: Anyone Using a Mac Studio for Local AI/LLM?

44•UmYeahNo•1d ago•28 comments

Ask HN: Ideas for small ways to make the world a better place

13•jlmcgraw•14h ago•19 comments

Ask HN: Non AI-obsessed tech forums

23•nanocat•12h ago•19 comments

Ask HN: 10 months since the Llama-4 release: what happened to Meta AI?

44•Invictus0•1d ago•11 comments

Ask HN: Non-profit, volunteers run org needs CRM. Is Odoo Community a good sol.?

2•netfortius•9h ago•1 comments

Ask HN: Who wants to be hired? (February 2026)

139•whoishiring•4d ago•514 comments

AI Regex Scientist: A self-improving regex solver

6•PranoyP•16h ago•1 comments

Ask HN: Who is hiring? (February 2026)

312•whoishiring•4d ago•511 comments

Tell HN: Another round of Zendesk email spam

104•Philpax•2d ago•54 comments

Ask HN: Is Connecting via SSH Risky?

19•atrevbot•2d ago•37 comments

Ask HN: Has your whole engineering team gone big into AI coding? How's it going?

17•jchung•2d ago•12 comments

Ask HN: Why LLM providers sell access instead of consulting services?

4•pera•22h ago•13 comments

Ask HN: What is the most complicated Algorithm you came up with yourself?

3•meffmadd•1d ago•7 comments

Ask HN: How does ChatGPT decide which websites to recommend?

5•nworley•1d ago•11 comments

Ask HN: Is it just me or are most businesses insane?

7•justenough•1d ago•6 comments

Ask HN: Any International Job Boards for International Workers?

2•15charslong•11h ago•2 comments

Ask HN: Mem0 stores memories, but doesn't learn user patterns

9•fliellerjulian•2d ago•6 comments

Ask HN: Is there anyone here who still uses slide rules?

123•blenderob•3d ago•122 comments

Kernighan on Programming

170•chrisjj•4d ago•61 comments

Ask HN: Anyone Seeing YT ads related to chats on ChatGPT?

2•guhsnamih•1d ago•4 comments

Ask HN: Does global decoupling from the USA signal comeback of the desktop app?

5•wewewedxfgdf•1d ago•2 comments

We built a serverless GPU inference platform with predictable latency

5•QubridAI•2d ago•1 comments

Ask HN: How Did You Validate?

4•haute_cuisine•1d ago•5 comments

Ask HN: Does a good "read it later" app exist?

8•buchanae•3d ago•18 comments

Ask HN: Have you been fired because of AI?

17•s-stude•4d ago•15 comments

Ask HN: Cheap laptop for Linux without GUI (for writing)

15•locusofself•3d ago•16 comments

Ask HN: Anyone have a "sovereign" solution for phone calls?

12•kldg•3d ago•1 comments

Test management tools for automation heavy teams

2•Divyakurian•2d ago•2 comments

Ask HN: OpenClaw users, what is your token spend?

14•8cvor6j844qw_d6•4d ago•6 comments
Open in hackernews

Proposal: Throw as a Special Variable for Auto Error Propagation in Go

2•iondodon•8mo ago
Proposal: Implicit Error Propagation via `throw` Identifier in Go

Abstract

This proposal introduces a new syntactic convention to Go: the use of the identifier `throw` in variable declarations or assignments (e.g., `result, throw := errorFunc()`). When detected, the compiler will automatically insert a check for a non-nil error and return zero values for all non-error return values along with the error. This mechanism streamlines error handling without compromising Go's hallmark of explicit, readable code.

Motivation

Go encourages explicit error handling, which often results in repetitive boilerplate code. For example:

result, err := errorFunc() if err != nil { return zeroValue, err }

This pattern, while clear, adds verbosity that can hinder readability, especially in functions with multiple error-prone calls. By introducing a syntactic shorthand that preserves clarity, we can reduce boilerplate and improve developer ergonomics.

Proposal

When a variable named `throw` is assigned the result of a function returning an `error`, and the enclosing function returns an `error`, the compiler will implicitly insert:

if throw != nil { return zeroValues..., throw }

Applicable Scenarios

Short declarations:

  x, throw := doSomething()
Standard assignments:

  x, throw = doSomething()
Variable declarations with assignment:

  var x T; var throw error; x, throw = doSomething()


* `throw` must be a variable of type `error`

* The surrounding function must return an `error`

* The rule only applies when the variable is explicitly named `throw`

Example

Traditional Error Handling

func getUserData(id int) (data Data, err error) { data, err := fetch(id) if err != nil { return Data{}, err } return data, nil }

With `throw`

func getUserData(id int) (Data, error) {

    data, throw := fetch(id)
    // Automatically expands to: if throw != nil { return Data{}, throw }

    moreData, throw := fetchMore(id)
    // Automatically expands to: if throw != nil { return Data{}, throw }

    return data, nil
}

Comments

NoahZuniga•8mo ago
While I have no experience with go, this seems like an interesting idea. Hackernews however isn't a great place to post this proposal if you want it to be implemented.

Maybe take a look at https://github.com/golang/proposal and if you want to share your proposal with hn, submit a link to the proposal here.