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.

Why OpenHAB?

https://www.openhab.org/
1•Bluestein•1m ago•0 comments

Pretraining progress is mostly coming from data

https://www.dwarkesh.com/p/pretraining-progress-is-mostly-data
1•gmays•1m ago•0 comments

Autonomy Preservation

https://simonsocolow.com/blog/keeping-autonomy-when-using-ai/
1•ssocolow•7m ago•0 comments

Mark Zuckerberg: "Cambridge Analytica" (2017)

https://twitter.com/TechEmails/status/2099214399840059428
2•mfiguiere•7m ago•0 comments

France announces <€1B in emergency farm support after 2026 summer

https://www.thescottishfarmer.co.uk/news/26534316.france-unveils-eur1-1bn-aid-package-drought-hit...
1•nephihaha•8m ago•1 comments

Predicting and Altering Human Opinions

https://hunchfox.com/blog/predicting-and-changing-human-opinions.html
2•sahil_chaudhary•10m ago•0 comments

Solve the Loop: Attractor Models for Language and Reasoning

https://arxiv.org/abs/2605.12466
1•jerlendds•10m ago•1 comments

A computational constitution to stop LLM agents from bricking servers

https://github.com/misqe/zero-trust-llm
2•misqe•11m ago•0 comments

A Layman's Guide to Linux Distros

https://petrisha.club/a-laymans-guide-to-linux-distros
1•lylo•12m ago•0 comments

Building projects in the AI era for Software Engineers

https://hsnice16.medium.com/building-projects-in-the-ai-era-for-software-engineers-72f3ddcd2a40
1•hsnice16•12m ago•0 comments

Object Storage Costs Compared

https://objectcost.com
1•montyanderson•12m ago•0 comments

Show HN: Credit against tokenised stocks for agents. punish us please

https://vaaya.ai/credit-against-securities-for-agents
1•nakulkelkar•13m ago•0 comments

So software is mostly dead and hardware it is

https://twitter.com/levelsio/status/2099098086035382334
2•acopetkovic•13m ago•0 comments

Americans Go Off at Data Center Town Hall

https://www.youtube.com/watch?v=IxvjA3H8nYw
2•emsign•15m ago•0 comments

Show HN: VibeWorld – a shared terminal world for developers and scientists

https://github.com/SorBalda/vibeworld
1•sorbalda•16m ago•0 comments

Hitting a NERVE with attacks on AI-powered brain-computer interfaces

https://anil.recoil.org/notes/nerve-attacks
3•matt_d•16m ago•1 comments

Show HN: One year in making, private/colleberative HTML5-canvas based editor

https://www.tasfer.app/en/
1•hamza512b•17m ago•0 comments

Method and system for navigating paginated content in page-based increments (2008)

https://patents.google.com/patent/US7415666B2/en
2•aragonite•18m ago•0 comments

145 Days of Uptime, 56 TiB of Traffic, One Debian Upgrade

https://sarah-robin.com/blog/debian-12-13
1•sarah-robiin•20m ago•0 comments

VR still makes 40-70% of players want to throw up

https://www.pcgamer.com/vr-still-makes-40-70-of-players-want-to-throw-up-and-thats-a-huge-problem...
4•andsoitis•22m ago•1 comments

OrigamiPhone

https://edwinarb.us/origamiphone/
1•edwinarbus•23m ago•0 comments

Cybersickness Variability by Race: Findings from 6 Studies

https://pmc.ncbi.nlm.nih.gov/articles/PMC9201708/
2•andsoitis•23m ago•0 comments

How the opium trade built one of the great cities

https://worldhistory.substack.com/p/singapore-straits-and-shadows
1•gdillard•24m ago•0 comments

Show HN: Railo – Deterministic AST security patches verified with Z3 SMT

https://www.railo.dev
1•mdzariflatif•24m ago•0 comments

Everyone Is Mossad Now

https://rosslazer.com/posts/everyone-is-mossad-now/
2•rosslazer•24m ago•1 comments

There Is No AI (It's Just People) with Jaron Lanier

https://singjupost.com/startalk-there-is-no-ai-really-its-just-people-w-jaron-lanier-transcript/
13•andsoitis•35m ago•2 comments

Show HN: Exende – 10k active jobs from 300 company sources through one API

https://www.exende.dev
1•daniellax•35m ago•0 comments

Show HN: Kibble – a reader for AI news, tutorials, code and models

https://www.kibblebites.com/app/
2•syedmubarak088•36m ago•0 comments

The Seizure of Bab El-Mandeb: Why Tanker Rates Are Exploding [video]

https://www.youtube.com/watch?v=n76tCHtJfmQ
4•toomuchtodo•37m ago•0 comments

Investment token from new economic trading platform worldwide

https://spare-change-01.vercel.app/
2•korerussbiz•38m ago•0 comments