What interface bugs have you ran into in the ecosystem?

Two examples I mentioned in a previous post:

  • Need for explicit interface specifications: I could not figure out how to implement the IO interface to solve a simple problem (counting bytes written to a stream).

  • Need for dispatch on interfaces: I wanted to implement a fallback last method for iterators. The interface is documented, but I can’t define last(::Iterator). I could not find a backward-compatible solution that dispatches without runtime penalty so I gave up .

Another classical case I think:

  • The redirect_stdio documentation says

    redirect_stdout([stream]) -> stream

    Create a pipe to which all C and Julia level stdout output will be redirected. Return a stream representing the pipe ends. Data written to
    stdout may now be read from the rd end of the pipe.

    Note: stream must be a compatible objects, such as an IOStream, TTY, Pipe, socket, or devnull.

    What does “a compatible object” mean? Impossible to say since there is no definition of a “stream interface”!

    This has caused problems when the user wants to capture the standard output to a buffer. The IOBuffer documentation says:

    Create an in-memory I/O stream […]

    So you’d think IOBuffer works with redirect_stdout, but it doesn’t. It’s been reported since 2015 but it’s still an open issue.

    Probably if there was an explicit specification of the stream interface, this issue would have been easier to fix.

3 Likes