a-recknagel / stenotype

Support for shorthand type annotations.
MIT License
3 stars 2 forks source link

Syntax Extension: Overloading #26

Open a-recknagel opened 5 years ago

a-recknagel commented 5 years ago

The typing-gitter recently had this comment:

I think people would appreciate having a less verbose option [...]. I know I'm not the only one that dislikes the current overloads, the django typing discussion (https://github.com/django/deps/pull/65) has comments like "The @overload section makes me shudder", "the tooling needs to catch up here", " when when it comes to the complex type definitions and overloads [...], my eyes start to hurt."

I haven't thought about them yet, but apparently should have. This issue serves as a collection of thoughts and discussion.

maxfischer2781 commented 4 years ago

We could support overloading as a simple Union of signatures (which it effectively is?).

# overload
foo: '(A) -> B or (C) -> D or (E, F) -> G'

# implementation
def foo(first, second=None):
    ...