api-doc-tools icon indicating copy to clipboard operation
api-doc-tools copied to clipboard

F#: Incomplete class/struct/interface signature representation

Open cartermp opened this issue 7 years ago • 0 comments

Classes and structs

Today, signatures for classes and structs look like this:

type Hoopty = class
    interface IDoopty

type Moopty = struct
    interface ISchwoopty

There are two correct ways to show these:

Append the end keyword and indent

type Hoopty =
    class
        interface IDoopty
    end

type Moopty =
    struct
        interface ISchwoopty
    end

Elide keywords and use [<Struct>]

type Hoopty =
    interface IDoopty

[<Struct>]
type Moopty =
    interface ISchwoopty

I much prefer the latter if it is possible.

Interfaces

Interfaces are shown today as such:

type IBanana = interface

This is also incorrect. I think we should add the end at the end for interfaces, as there's no other way to show them that will make it clear that it's an interface unless we also show each of the members.

type IBanana = interface end

That said, I would much prefer if we could show all interface members in signatures, at least for F#. That way this:

type IDisposable = interface end

Would look like this:

type IDisposable =
    abstract Dispose: unit -> unit

Even for large interfaces, it's just one additional line per member. I don't know what the largest interface in all of .NET is, but they keep them small so that people can be sane.

cartermp avatar Jun 22 '18 16:06 cartermp