> My understanding is that, in functional languages that use pattern matching, 
> the different functions with the same name get merged together into one 
> function by the compiler, with a switch/case expression to distinguish 
> between the different cases.

Think of it as just a special syntax that Haskell and some other languages have 
to define the function. There is no polymorphism or anything deep going on. 
Just a special syntax.

> As others have already said, it's runtime polymorphism, as opposed to the 
> compile-time polymorphism of Nim's (or C++s, etc.) function overloading.

It's no kind of polymorphism at all, just a syntax for Haskell to define 
functions. It's no different from the OCaml with a pattern match. Nim loses 
nothing by not having a syntax to do definitions this way; I never missed this 
in OCaml. Haskell's "overloading" is from type classes, though strictly 
speaking that is not really overloading. That is something I missed in OCaml. 

Reply via email to