question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improve multiple dispatch

See original GitHub issue

Currently, multiple dispatch using def and case is rather clunky. The suggestion is to replace

def some_func(x):
    case x:
        match _ is int:
            do_stuff_for_int(x)
        match _ is str:
            do_stuff_for_str(x)

with

case def some_func:
    match x is int:
        do_stuff_for_int(x)
    match x is str:
        do_stuff_for_str(x)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
evhubcommented, Jun 21, 2016

Interesting idea—I’ll definitely look into that and see what I can do.

0reactions
datnamercommented, Jun 24, 2016

Awesome!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why Multiple Dispatch Is My Favorite Way To Program
Multiple dispatch is a way that we can apply function calls as properties of types. In other words, we can redefine the same...
Read more >
Implementing Multiple Dispatch - C2 wiki
Does anyone know of an efficient implementation of MultipleDispatch, comparable to Smalltalk's InlineCaching of messages or C++'s vtbl mechanism?
Read more >
Multiple dispatch - Wikipedia
Multiple dispatch routes the dynamic dispatch to the implementing function or method using the combined characteristics of one or more arguments.
Read more >
A polyglot's guide to multiple dispatch - Eli Bendersky's website
This is the first article in a series dedicated to multiple dispatch - an advanced abstraction technique available to programmers ...
Read more >
Multiple Dispatch - Matthew Rocklin
Multiple dispatch separates interaction code from core code. This opens and democratizes interaction, for better or for worse.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found