News for hackers. Stuff that matters.
Re:Why Checked Exceptions Failed by duped on Saturday July 15, 2023 @12:21PM (#36738306)
> Will you require that the acceptable functions only throw exceptions that you like? -- Then your generic function is close to being worthless...

Constrained generic parameters are actually super useful.

> If exceptions are encoded in function's interface, then they have to be in ABI

They already are in Itanium

> you cannot serialize the communication using some protocol with a fixed number of types (eg. JSON and friends), because now you need to account for the infinite variety of exception types.

No, the only exception that arises is ser/deserialization error. You can also trivially represent an error in JSON using an object, which is exactly what JSON RPC protocols do. It's also never safe to throw across an FFI boundary and similarly nonsensical to throw across a serialization boundary, so I'm not sure why you'd care.

Re:Why Checked Exceptions Failed by crabbone on Sunday July 16, 2023 @04:38AM (#36744828)
> Constrained generic parameters are actually super useful.

Then you missed the main point: if you require the generic function to accomodate all sorts of kinds of exceptions raised by the functions it may call, this requirements now propagates to every function it may call. So, you end up implementing functions with unnecessary "throws" because they might be used in a generic function which had to add that clause because of some other completely unrelated function.

Alternatively, you aren't writing generic code at all, you just write two implementations which happen to have similar names.