DEV Community

Discussion on: Ruby – Pattern Matching – Second Impressions

Collapse
 
katafrakt profile image
Paweł Świątkowski

From what I know about Crystal, it has method overload only by types (much like Java). And hear it would be possible to also "overload" by particular values - for example different method for hash containing a key "success".

Collapse
 
edisonywh profile image
Edison Yap

Correct, that's what overloading means - defining methods with same name but with different method signatures, and method signatures are usually types & arity.

What you're referring to (in Elixir) is a combination of both - when you have pattern matching, your method signatures aren't just types & arity, but also patterns.