samdphillips
2021-2-26 20:57:40

A random thought I had recently, was that it would be good for packages to document exceptions used and raised by their code. Also what logging topics that the package uses.


samdphillips
2021-2-26 20:57:58

Maybe a template in scribble for these kind of things?


sorawee
2021-2-26 21:00:01

Related: why does checked exception in Java get a bad rap? It looks like a good idea.


samdphillips
2021-2-26 21:23:53

That is my #1 “unpopular” java opinion


samdphillips
2021-2-26 21:26:04

In Racket I end up wrapping a function I know will fail with (with-handlers ([exn:fail? values]) ...) so I can figure out a more precise exn predicate.


samth
2021-2-26 21:27:17

A few reasons


notjack
2021-2-27 00:00:27

The main reason checked exceptions in java can be frustrating is that they don’t integrate well with the type system, so libraries that take lambdas get complicated and often don’t bother supporting them. The map and filter operations on java streams don’t allow checked exceptions at all, for example, whereas the corresponding for loop would simply propagate the checked exception requirements to the surrounding code.


kellysmith12.21
2021-2-27 00:39:04

For a while, I’ve been pondering an API equivalent of “nutrition facts” labels. It could include details on time and space consumption, exceptions that may be thrown, and other useful domain-specific details, like if a hashing procedure is suitable for cryptographic purposes or what sorts of grammars a parsing framework can accept. This would be an easy way to incorporate RDF into the docs, which I remember seeing an issue about, some time ago.


kellysmith12.21
2021-2-27 01:08:29

I got the idea from Wikipedia’s info boxes and how they are tailored for algorithms:


samth
2021-2-27 02:52:14
  1. No polymorphism

samth
2021-2-27 02:52:28
  1. Significant annotation burden

samth
2021-2-27 02:55:08
  1. The presence of runtime exceptions mean you get less of a guarantee than you hope

notjack
2021-2-27 02:58:06

I think wikipedia in general has some pretty great ideas to steal when it comes to writing reference documentation


zafar.huma
2021-2-27 04:04:31

Is https://github.com/racket/scribble/issues/228\|this the issue you were referring to? FWIW, if there’s any need for help on that, I’d be happy to contribute some time (linked data is my day job atm :smile:).


kellysmith12.21
2021-2-27 04:36:30

@zafar.huma Yep, that’s the one :smile: