frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

Avoid Continue

https://www.teamten.com/lawrence/programming/avoid-continue.html
2•todsacerdoti•1y ago

Comments

zoezoezoezoe•1y ago
I dont know if I fully agree. Sure, there is definitely an argument the be had about whether or not `continue` is the best word to use in this instance, but why avoid it entirely? Every programmer is able to easily understand what code like this would do:

``` for (Node node : nodeList) { if (node.isBad()) { continue; } processNode(node); } ```

Every keyword in any programming language is largely arbitrary in my opinion let's take a look at the beginning of the codeblock `for (Node node : nodeList)` also completely arbitrary, though it's clear to anyone who's ever written C++ that it is equivalent to saying "for every node in nodeList".

Continue is not meant to read as "continue execution" it's meant to be "continue to the next item of the list", and I think avoiding it entirely is a pointless effort.

Ukv•1y ago
I feel `skip` may have been a better name, but disagree with it being logically difficult to parse beyond that.

If I'm reading a loop and see

    for x in y {
        if exclusions.contains(x) { skip; }
        if x.children.length == 0 { skip; }
        if os.file.exists(x.name) { skip; }
        ...
I instantly know that processing for those elements is skipped, and they won't be relevant for the rest of the loop.

Whereas if I see

    for x in y {
        if !exclusions.contains(x) {
            if x.children.length != 0 {
                if !os.file.exists(x.name) {
        ...
I feel like there's still mental overload with not knowing where those `if` blocks end, and so having to keep the conditions in mind. It doesn't immediately tell me that the rest of the loop is being skipped.

The `log()` mistake seems no less likely to happen using early-returns in function instead, and I'd argue nesting checks actually introduces more room for that kind of error overall, where you append something at the end within the wrong set of brackets, compared to a flatter structure.

LessWrong Sans AI

https://jimrandomh.github.io/LesswrongSansAI/
1•mudil•3m ago•0 comments

For my 80th birthday, I bought myself a new brain

https://bjsm.bmj.com/content/60/9/677
1•convict•3m ago•1 comments

DAO DE JING

https://factsanddetails.com/china/cat3/sub10/entry-5577.html
1•Bluestein•5m ago•0 comments

We ran AI agent swarms in Minecraft and Mindustry

https://labs.ycombinator.com/projects/games/index.html
4•sandslash•8m ago•0 comments

Show HN: KernelCash – Privacy First Budgeting

1•LoftyHobbitMan•9m ago•0 comments

Binance-hacker-1029 – $5.6B stolen from Binance

https://arkm.com/explorer/entity/21a94755-f604-45e5-9501-6542e23005e8
13•Tiberium•9m ago•2 comments

Binance Hacked

https://twitter.com/officer_secret/status/2115906754328383521
2•dinoqqq•10m ago•0 comments

Show HN: Artificer by Nua: Frontier robotics task evaluation in 4B parameters

https://usenua.com/blog/artificer
3•SunnyWan•12m ago•2 comments

Cross-Model LLM Pricing API

https://www.metergraph.dev/pricing-api/
2•alexray•12m ago•0 comments

Is Binance Being Hacked? $2B Outflow Puts Customer Funds in Question

https://beincrypto.com/is-binance-being-hacked-customer-funds/
2•pr0zac•12m ago•0 comments

Show HN: SiteSpin – Build and update business websites through chat

https://sitespin.app/
1•adamhsn•13m ago•0 comments

The Wayback Machine Labs

https://wayback-labs.sf.archive.org/
2•sans_souse•16m ago•0 comments

The Origin Story of Candy Corn

https://www.wsj.com/lifestyle/travel/candy-corn-halloween-traditions-history-0d487ec0
1•bookofjoe•16m ago•1 comments

Ask HN: Opus 5.5 suddenly dumb as rocks?

5•jahala•17m ago•0 comments

Show HN: SortSage – Automatic rules-based file organizer

https://enlightpixel.com/products/sortsage
4•enlightpixel•17m ago•0 comments

The End of Consensus Research?

https://arxiv.org/abs/2610.30114
1•chriscbr•18m ago•0 comments

Polymarket Halted International Trading After Hackers Drained Accounts

https://www.wired.com/story/polymarket-flagship-platform-hack-traders-lose-money/
7•vinyl7•19m ago•3 comments

Show HN: AI Knows Us – see who ChatGPT and Perplexity recommend instead of you

https://www.aiknowsus.com
2•goeladityx•21m ago•0 comments

Over $5B drained from Binance in apparent hack

http://twitter.com/emmettgallic/status/2115916025774723210
18•int32_64•23m ago•0 comments

Binance hot wallet drained of about $2.5B in tokens on Ethereum

https://etherscan.io/address/0x5227f603c1ee34ce3c06efe6477003bdfccb2f8c
17•vagabund•25m ago•3 comments

Accidentally exposing repo files on Vanilla JavaScript Vercel sites?

https://github.com/dirkjbosman/vanilla_next
1•DrDizzle•26m ago•0 comments

Fax API – Faxette

https://www.faxette.com/api
2•yakkomajuri•26m ago•0 comments

A Beer Brewer's Noise Estimation

https://chillphysicsenjoyer.substack.com/p/a-beer-brewers-noise-estimation
1•crescit_eundo•27m ago•0 comments

Programming at Light Speed: Building the Gravity Query Engine

https://malisper.me/programming-at-light-speed/
1•andreaja•27m ago•0 comments

Undisclosed Patch Vulnerability Caused HTTP2Shell via If-Statement

https://www.bugsink.com/blog/brotli-stale-table-read/
1•birdculture•27m ago•0 comments

If we stop, we lose: can developer education come back?

https://piccalil.li/blog/if-we-stop-we-lose/
2•tanvibhakta•27m ago•1 comments

DebugBear Security Incident

https://twitter.com/DebugBear/status/2115866496643535293
3•vldszn•28m ago•1 comments

Polymarket Got Hacked. Here's What Their Post Didn't Tell You

https://twitter.com/brianskellenger/status/2115890675237392452
3•Bluestein•29m ago•0 comments

Automatia: A Place to Call Home

https://automatiagame.com/blog/a-place-to-call-home/
1•fwsgonzo•32m ago•0 comments

Keep your home server reachable with Dynamic DNS

https://www.fastmail.com/blog/keep-your-home-server-reachable-with-dynamic-dns/
2•sp8•32m ago•0 comments