Hacker News new | ask | show | jobs
by rw 3681 days ago
Under the documentation section for "Ambiguous Methods"[0], why does the example compile? I would expect it to barf at compile time, not runtime.

[0] http://lbstanza.org/chapter4.html#anchor52

1 comments

In julia we switched to making method ambiguities a runtime error because you often end up with situations where even though there are ambiguous methods, you don't ever really want to call them (because they don't make much sense semantically or because they came from different packages, etc). Stanza looks a little more static than julia in this regard, so perhaps they do want to make it a compile-time error (or at least make calling it a compile-time error if types are declared).
We are planning to add a static method ambiguity check in Stanza.

There are just some theoretical hurdles to solve in order to detect them properly in the presence of parametric types. That's been recently solved (though not by us) so we'll be implementing their solution soon.

Hi Patrick, can you point to a paper / resource that describes this recent work?
Sure. The paper is called "Type Checking Modular Multiple Dispatch with Parametric Polymorphism and Multiple Inheritance" by Allen, Hilburn, et al.