frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Yann LeCun to depart Meta and launch AI startup focused on 'world models'

https://www.nasdaq.com/articles/metas-chief-ai-scientist-yann-lecun-depart-and-launch-ai-start-fo...
105•MindBreaker2605•1h ago•50 comments

You will own nothing and be (un)happy

https://racc.blog/you-will-own-nothing-and-be-unhappy/
60•showthemfangs•2h ago•32 comments

Simulating a Planet on the GPU: Part 1 (2022)

https://www.patrickcelentano.com/blog/planet-sim-part-1
22•Doches•1h ago•3 comments

X5.1 solar flare, G4 geomagnetic storm watch

https://www.spaceweatherlive.com/en/news/view/593/20251111-x5-1-solar-flare-g4-geomagnetic-storm-...
308•sva_•11h ago•91 comments

Bluetooth 6.2 – more responsive, improves security, USB comms, and testing

https://www.cnx-software.com/2025/11/05/bluetooth-6-2-gets-more-responsive-improves-security-usb-...
78•zdw•6d ago•45 comments

Laptops with Stickers

https://stickertop.art/main/
363•z303•1w ago•328 comments

I didn't reverse-engineer the protocol for my blood pressure monitor in 24 hours

https://james.belchamber.com/articles/blood-pressure-monitor-reverse-engineering/
210•jamesbelchamber•11h ago•76 comments

Perkeep – Personal storage system for life

https://perkeep.org/
160•nikolay•5h ago•35 comments

.NET MAUI is coming to Linux and the browser

https://avaloniaui.net/blog/net-maui-is-coming-to-linux-and-the-browser-powered-by-avalonia
201•vyrotek•9h ago•154 comments

Four strange places to see London's Roman Wall

https://diamondgeezer.blogspot.com/2025/11/odd-places-to-see-londons-roman-wall.html
143•zeristor•10h ago•39 comments

The terminal of the future

https://jyn.dev/the-terminal-of-the-future
192•miguelraz•12h ago•91 comments

Pikaday: A friendly guide to front-end date pickers

https://pikaday.dbushell.com
209•mnemonet•17h ago•87 comments

The history of Casio watches

https://www.casio.com/us/watches/50th/Heritage/1970s/
229•qainsights•3d ago•116 comments

A modern 35mm film scanner for home

https://www.soke.engineering/
191•QiuChuck•12h ago•145 comments

FFmpeg to Google: Fund us or stop sending bugs

https://thenewstack.io/ffmpeg-to-google-fund-us-or-stop-sending-bugs/
828•CrankyBear•14h ago•596 comments

Fixing LCD Screen Corruption of a Tektronix TDS220 Oscilloscope

https://tomverbeure.github.io/2025/11/03/TDS220-LCD-Corruption-Fix.html
22•groseje•1w ago•1 comments

Why Nietzsche matters in the age of artificial intelligence

https://cacm.acm.org/blogcacm/why-nietzsche-matters-in-the-age-of-artificial-intelligence/
96•pseudolus•8h ago•65 comments

Heroku Support for .NET 10

https://www.heroku.com/blog/support-for-dotnet-10-lts-what-developers-need-know/
70•runesoerensen•10h ago•26 comments

The Department of War just shot the accountants and opted for speed

https://steveblank.com/2025/11/11/the-department-of-war-just-shot-the-accountants-and-opted-for-s...
183•ridruejo•18h ago•284 comments

My fan worked fine, so I gave it WiFi

https://ellis.codes/blog/my-fan-worked-fine-so-i-gave-it-wi-fi/
165•woolywonder•6d ago•59 comments

Scaling HNSWs

https://antirez.com/news/156
181•cyndunlop•18h ago•40 comments

We ran over 600 image generations to compare AI image models

https://latenitesoft.com/blog/evaluating-frontier-ai-image-generation-models/
145•kalleboo•15h ago•85 comments

Problems with C++ exceptions

https://marler8997.github.io/blog/bjarne-fix-your-language/
53•signa11•2h ago•47 comments

A catalog of side effects

https://bernsteinbear.com/blog/compiler-effects/
95•speckx•12h ago•7 comments

Agentic pelican on a bicycle

https://www.robert-glaser.de/agentic-pelican-on-a-bicycle/
79•todsacerdoti•13h ago•54 comments

Collaboration sucks

https://newsletter.posthog.com/p/collaboration-sucks
386•Kinrany•12h ago•214 comments

Meticulous (YC S21) is hiring to redefine software dev

https://jobs.ashbyhq.com/meticulous/3197ae3d-bb26-4750-9ed7-b830f640515e
1•Gabriel_h•11h ago

Hard drives on backorder for two years as AI data centers trigger HDD shortage

https://www.tomshardware.com/pc-components/hdds/ai-triggers-hard-drive-shortage-amidst-dram-squee...
34•pabs3•3h ago•21 comments

Array-programming the Mandelbrot set

https://jcmorrow.com/mandelbrot/
72•jcmorrow•5d ago•9 comments

Adk-go: code-first Go toolkit for building, evaluating, and deploying AI agents

https://github.com/google/adk-go
72•maxloh•12h ago•22 comments
Open in hackernews

Problems with C++ exceptions

https://marler8997.github.io/blog/bjarne-fix-your-language/
53•signa11•2h ago

Comments

Flundstrom2•2h ago
Java and Rust are the only language that I know of that has proper handling of exceptions; mandatory declaration as part of method declaration, since exceptions ARE an integral part of the contract. (Yes, I consider the Result<T, E> being corresponding to exception declaration, since the return value MUST be checked prior to use of T.)
nielsbot•2h ago
Swift user here: I have to say one of the best features of Swift is the exception handling. Which is to say, exceptions in Swift are not C++/Java/Obj-C style exceptions, but instead are a way to return an error result from a function. And Swift enforces that the error is handled.

That is, a `throw` statement in Swift simply returns an `Error` value to the caller via a special return path instead of the normal result.

More explicitly, a Swift function declared as:

    func f() throws -> T {
    }
Could be read as

    func f() -> (T|any Error) {
    }

More here: https://github.com/swiftlang/swift/blob/main/docs/ErrorHandl...
thomasmg•2h ago
I saw that in Swift, a method can declare it throws an exception, but it doesn't (can't) declare the exception _type_. I'm not a regular user of Swift (I usually use Java - I'm not sure what other languages you are familiar with), but just thinking about it: isn't it strange that you don't know the exception type? Isn't this kind of like an untyped language, where you have to read the documentation on what a method can return? Isn't this a source of errors itself, in practise?
mayoff•1h ago
Swift gained limited support for “typed throws” in Swift 6.0 (2024).

https://github.com/swiftlang/swift-evolution/blob/main/propo...

I say limited because the compiler doesn't (yet, as of 6.2) perform typed throw inference for closures (a closure that throws is inferred to throw `any Error`). I have personally found this sufficiently limiting that I've given up using typed throws in the few places I want to, for now.

Someone•1h ago
> isn't it strange that you don't know the exception type?

Java experience taught us that, when writing an interface, it is common not to know the exception type. You often can’t know, for example, whether an implementation can time out (e.g. because it will make network calls) or will access a database (and thus can throw RollbackException). Consequently, when implementing an interface, it is common in Java to wrap exceptions in an exception of the type declared in the interface (https://wiki.c2.com/?ExceptionTunneling)

magicalhippo•1h ago
What I liked about Bosst's error_code[1], which is part of the standard library now, is that it carties not just the error but the error category, and with it a machinery for categories to compare error_codes from other categories.

So as a user you could check for a generic file_not_found error, and if the underlying library uses http it could just pass on the 404 error_code with an http_category say, and your comparison would return true.

This allows you to handle very specific errors yet also allow users to handle errors in a more generic fashion in most cases.

[1]: https://www.boost.org/doc/libs/latest/libs/system/doc/html/s...

fakwandi_priv•2h ago
From what I can read Swift gives you a stack trace which is good. At the moment I’m using Go where that stack is only generated where the panic is triggered, which could be much higher up. Makes it a lot more unwieldy to figure out where an error happens because everyone uses:

> if err != nil return err

mayoff•1h ago
Swift doesn't capture a stack trace in the `Error` object, but Xcode can break when an error is thrown if you set a “Swift Error Breakpoint”, and the debugger will show you the stack trace. Under the hood it just sets breakpoints on the runtime functions `swift_willThrow` and `swift_willThrowTypedImpl`.
mayoff•1h ago
Another really nice thing about Swift is that you have to put the `try` keyword in front of any expression that can throw. This means there's no hidden control flow: if some function call can throw, you're informed at the call site and don't have to look at the function declaration.
munchler•2h ago
`Result<T, E>` comes from Haskell's `Either a b` type. F# also has a `Result<'T, 'E>` type.

It's funny how often functional programming languages lead the way, but imperative languages end up with the credit.

JoshTriplett•1h ago
In fairness, Rust also has unchecked exceptions (panics, if you use panic-unwind).
majormajor•2m ago
Java too has unchecked exceptions, though the post praising "mandatory declaration" didn't mention it for either.

But they CAN be caught with a standard catch which may be non-intuitive if you don't know about them, and about that, in advance.

morshu9001•1h ago
In high-level code, pretty much everything can fail in many different ways, and usually you're either just passing the error up or handling it in some catchall manner. Rust's behavior makes sense for its use cases, but it'd get exhausting doing this in like a web backend.
wahern•1h ago
It's already too exhausting to use for OOM, which is why Rust effectively punted on that from the very beginning. And the ironic thing is that anyhow::Error (or similar) seems poised to become idiomatic in Rust, which AFAIU always allocates, while the extremely belated try_ APIs... does anybody even use them?

It's a shame. Were I designing a "low-level" or "systems" language, rather than put the cart before the horse and pick error results or exceptions, my litmus test would be how to make handling OOM as easy as possible. Any language construct that can make gracefully handling OOM convenient is almost by definition the fabled One True Way. And if you don't have a solution for OOM from the very beginning (whether designing a language or a project), it's just never gonna happen in a satisfactory way.

Lua does it--exceptions at the language level, and either setjmp/longjmp or C++ exceptions in the VM implementation. But for a strongly typed, statically compiled language, I'm not sure which strategy (or hybrid strategy) would be best.

morshu9001•1h ago
Hm, not sure how you'd do this. OOM error auto bubbling up sounds dangerous because the inner code might not leave things in a consistent state if it exits unexpectedly, so that makes sense to manually handle, but it's tedious. Rust at least has nice ? and ! syntax for errors, unlike Go where the error-prone error handling actually ruins the entire language.
aw1621107•1h ago
> while the extremely belated try_ APIs... does anybody even use them?

I want to say the main driver for those right now is Rust for Linux since the "normal" panicking behavior is generally undesirable there.

MindSpunk•16m ago
I think Rust's choice to panic on OOM is the right choice for 95% of code people write. It would be absurdly verbose, and OOM can be very tricky to recover from without careful top down design because it's very easy for error handling code to itself try and allocate (print/format a message) leading to a process abort. The mistake was not having the fallible APIs on allocating containers from the start, for the users that do care and can tangibly recover.

Depending on the OS you likely won't even get the chance to handle the error because the allocation never fails, instead you just over commit and kill the process when physical memory gets exhausted.

I guess what I'm trying to say is designing your language's error handling primitives around OOM is probably not a good idea, even in a systems programming language, because it's a very rare class of generally unrecoverable error that only very carefully designed code can recover from.

Anyhow allocating isn't that absurd either. It keeps the size of Result<T, E> down by limiting the 'E' to be a pointer. Smaller Result<T, E> can help the compiler generate better code for passing the return value, and the expectation is the error path is rare so the cost of allocating might be outweighed by the lighter Result<T, E> benefits. Exceptions take a similar standpoint, throwing is very slow but the non-exceptional path can (theoretically) run without any performance cost.

muragekibicho•2h ago
Honestly, I thought the diatribe would focus on needless complexity.

The starting example is how I'd do it in C:

```

void f(const char* p) // unsafe, naive use

{

    FILE \*f = fopen(p, "r");    // acquire

    // use f

    fclose(f);                  // release
}

```

Wouldn't the simpler solution be ensuring your function doesn't exit before release? All that c++ destroyer stuff appears somewhat unnecessary and as the author points out, creates even more problems.

mgaunard•2h ago
That means you cannot use early exit, and all your variables must be checked as to whether they were initialized (which on top of the checks might also require further state).
themafia•1h ago
You can use goto to jump to one of several exit conditions based on the level of cleanup you need. It also nicely unifies all error exits into one place. The kernel makes heavy use of this style.
mgaunard•13m ago
sure, but that has limitations as well, since gotos can't cross lexical scopes, so you can't introduce variables later on, and it's easy to mess up.

Destructors are a higher-level and safer approach.

nanolith•2h ago
In C, you're correct. The problem is that, in C++, one must account for the fact that anything could throw an exception. If something throws an exception between the time that f is opened and f is closed, the file handle is leaked. This is the "unsafe" that Bjarne is talking about here. Specifically, exception unsafety that can leak resources.

As an aside, it is one of the reasons why I finally decided to let go of C++ after 20 years of use. It was just too difficult to teach developers all of the corner cases. Instead, I retooled my system programming around C with model checking to enforce resource management and function contracts. The code can be read just like this example and I can have guaranteed resource management that is enforced at build time by checking function contracts.

dmpk2k•1h ago
Could you elaborate on the model checking? You have two codebases then (model and C), or something more integrated?
nanolith•1h ago
The function contracts are integrated into the codebase. Bounded model checking tools, such as CBMC, can be used to check for integer UB, memory safety, and to evaluate custom user assertions. The latter feature opens the door for creating function contracts.

I include function contracts as part of function declarations in headers. These take the form of macros that clearly define the function contract. The implementation of the function evaluates the preconditions at the start of the function, and is written with a single exit so the postconditions can be evaluated at the end of the function. Since this function contract is defined in the header, shadow functions can be written that simulate all possibilities of the function contract. The two are kept in sync because they both depend on the same header. This way, model checks can be written to focus on individual functions with any dependencies simulated by shadows.

The model checks are included in the same project, but are separate from the code under instrumentation, similar to how unit tests are commonly written. I include the shadow functions as an installation target for the library when it is installed in development mode, so that downstream projects can use existing shadow functions instead of writing their own.

mayoff•1h ago
The problem is that it's easy to do it wrong and the C compiler doesn't help you. RAII prevents you from leaking the resource, but the complaint in the post is that it can be cumbersome to use RAII in C++ if acquisition can fail and you want to handle that failure.
jari_mustonen•2h ago
The classic "Frequently Questioned Answers" is the ultimate takedown of this abomination of a language.

https://yosefk.com/c++fqa/

mgaunard•2h ago
Author completely misunderstands how to use exceptions and is just bashing them. A lot of what he says is inaccurate if not outwardly incorrect.

Also Bjarne's control of C++ is quite limited, and he is semi-retired, so asking him to "fix his language" is fairly misguided. It's designed by a committee of 200+ people.

Anyway what you want seems to be to not use exceptions, but monads instead. These are also part of the standard, it's called std::expected.

gblargg•2h ago
Agreed. Author is trying to mix paradigms. Simplest approach if they want local handling and non-propagation of errors is to just have the file holder not check for open success, and check that manually after construction. Then you get guaranteed closure of file no matter how the function is exited.

  class File_handle {
      FILE *p;
  public:
      File_handle(const char *pp, const char *r)  { p = fopen(pp, r); }
      ~File_handle() { if ( p ) fclose(p); }
      FILE* file() const { return p; }
  };
  
  
  void f(string s)
  {
      File_handle fh { s, "r"};
      if ( fh.file() == NULL ) {
          fprintf(stderr, "failed to open file '%s', error=%d\n", p, errno);
          return;
      }
      // use fh
  }
mikhael•1h ago
this may lose the value of errno, right?
dardeaup•1h ago
Yes, it would. It would be trivial to add errno as an instance variable for File_Handle class though.
lynx97•1h ago
Most criticism of C++ comes from people not really into the language. Sure, learning curve might be an issue. But if you are really into C++, there are a lot of things to like about it. At least I do love it. However, only since C++11. Before that, the language felt very strange to me, possibly due to the same effect, I didn't know enough about it.
matu3ba•1h ago
> Author completely misunderstands how to use exceptions and is just bashing them. A lot of what he says is inaccurate if not outwardly incorrect.

Do you mind to elaborate what you believe are the misunderstandings? Examples of incorrect/inaccurate statements and/or an article with better explanations of mentioned use cases would be helpful.

> it's called std::expected

How does std::expected play together with all other possible error handling schemas? Can I get unique ids for errors to record (error) traces along functions? What is the ABI of std::expected? Stable(ish) or is something planned, ideally to get something C compatible?

mgaunard•1m ago
Well, he's using try/catch locally. You're not supposed to handle errors locally with exceptions. The whole point is inversion of control, you manage them at the point where you can do meaningful recovery, which then triggers the cleanup of the whole stack of frames once the exception bubbles up, rather than systematically cleaning up on the normal control flow path.

Regardless, in his example, he could achieve what he wants by wrapping the try in a lambda, and returning either the value from try or nullopt from catch. But clearly, that's just converting exceptions to another error-handling mechanism because he isn't doing it right.

He claimed that not handling an exception causes the program to crash, that's just plain incorrect. To be fair many people use the term "crash" liberally.

std::expected or equivalent is often used with std::error_code, which is an extensible system (error codes are arranged in categories) that among others interops with errno.

lealanko•2h ago
This is a common problem with try-catch syntax. An alternative, and arguably more useful syntax would be

  try (File_handle fh {s, "r"}) {
    // use fh
  } unless (const File_error& e) {
    // handle error
  }
Where the "use fh" part is not covered by the exception handler. This is covered (in ML context) in https://www.microsoft.com/en-us/research/publication/excepti...
mgaunard•2h ago
Don't use try/catch in the first place; that's where his error lies.
charcircuit•1h ago
>The first is that our error message may not be correct. It’s possible that the exception we’ve caught was not introduced by opening this file, and, the errno may not reflect the errno at the time fopen was called.

All that is needed is a better File_error type that includes the error that happened.

  void f(string s)
  {
      try {
          File_handle fh { s, "r"};
          // use fh
      } catch (const File_error& e) {
          fprintf(stderr, "File error: %s\n", e.msg.c_str();
          return;
      }
  }
oakpond•1h ago
The first two problems can be solved in a straightforward way with more custom exception types. For the "bigger problem", catch(...) can be used to prevent your code from crashing. If you really want to handle each case explicitly you could also use enums in combination with compiler flags that enable exhaustive checking.
SuperV1234•1h ago
This post completely misunderstands how to use exceptions and provides "solutions" that are error-prone to a problem that doesn't exist.

And this is coming from someone that dislikes exceptions.

miohtama•1h ago
It's a bad post, but I find it funny someone thinks C++ can be fixed (:
gorgolo•1h ago
I didn’t really understand the writer’s comments with exceptions and I don’t code in C++.

Their main complaint about exceptions seems to be that you can’t handle all of them and that you don’t know which you’ll get? If we compare this to python, what’s the difference here? It looks like it works the same here as in python; you catch and handle some exceptions, and others that you miss will crash your program (unless you catch the base class). Is there something special about C++ that makes it work differently, or would the author have similar problems with python?

wvenable•1h ago
I agree with the other comments that this understanding of exceptions is wrong. He's not wrong about these two points:

- Correctness: you don’t know if the exception type you’ve caught matches what the code throws

- Exhaustiveness: you don’t know if you’ve caught all exceptions the code can throw

But that's actually not a problem. Most of the time you shouldn't catch a specific exception (so always correct) and if you are catching then you should catch them all (exhaustive). A better solution is merely:

    void f(string s)
    {
        try {
            File_handle fh { s, "r"};
            // use fh
        } catch (const std::exception& e) {
            printf(stderr, e.what());
        }
    }
That's all you need. But actually this code is also bad because this function f() shouldn't have a try/catch in it that prints an error message. That's a job for a function (possibly main()) further up the call stack.
smallstepforman•1h ago
My biggest beef with exceptions is invisible code flow. Add the attribute throws<t> to function signature (so that its visible) and enforce handling by generating compiler error if ignored. Bubbling up errors is OK. In essence, this is result<t,e>. Thats OK. Even for constructors.

What I dislike is having a mechanism to skip 10 layers of bubbling deep inside call stack by a “mega” throw of type <n> which none of the layers know about. Other than

classified•1h ago
If you use names that frigging bad, exceptions are the least of your problems.
howtofly•1h ago
All this hassle can be avoided by using `cleanup` compiler attribute.

Manage classical C resources by auto-cleanup variables and do error-handling the normal way. If everything is OK, pass the ownership of these resources from auto-cleanup variables to C++ ctor.

Note this approach plays nicely with C++ exception, and will enter C standard in the form of `defer`.

pmontra•1h ago
Or do without exceptions for control flow. For example Elixir does have try/catch but it's used very rarely because most functions return tuples with the first element being either :ok or :error. Then we can pattern match it and return an :error to the caller if we have to, possibly bubbling up several levels return after return. Or let the process crash and restart while the rest of the application keeps running. A surprising number of errors eventually fix themselves (API calls, disk space, missing data) when you design the system to attempt more times to complete its tasks. That's not only a characteristic of Elixir and the BEAM languages. You can do it more or less easily on any language. Maybe you need a queue and workers reading from the queue and all it takes to manage them, and BEAM makes it convenient by including most of it.

The page about try/catch explains it well https://hexdocs.pm/elixir/try-catch-and-rescue.html

senderista•53m ago
Or, if you don't want to go to the trouble of writing an RAII wrapper class for FILE*, just use scope_guard and (after determining that fopen() succeeded) register a lambda to close the FILE* on exiting the function (including by throwing an exception). I'm not a huge fan of scope_guard (or defer() in other languages), but it gets the job done for one-off cases.
febusravenga•51m ago
I think i agree with commenters that article kind-of uses exceptions wrong.

But this shows problems with C++ exceptions, C++ codebases are literred with bad exception usage because "normal" programmers don't get it. Most of didn't get it for long time. So, they are complex enough that their usage is risk.

Anyway, IMO C++ exceptions have two fundametal problems:

* lack of stacktrace, so actually lack of _debugabbility_, that's why people try/catch everything

* destructor problem (that actually there are exceptions tht cannot be propagated further and are lost