Skip to content

Instantly share code, notes, and snippets.

@def-
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save def-/cb05159fe18e3c3dfe12 to your computer and use it in GitHub Desktop.
Save def-/cb05159fe18e3c3dfe12 to your computer and use it in GitHub Desktop.
Ambiguous
type
Time = distinct float
Frequency = distinct float
Radioactivity = distinct float
proc `/` *(x: float, y: Time): Frequency = Frequency(x / float(y))
proc `/` *(x: float, y: Time): Radioactivity = Radioactivity(x / float(y))
# Error: ambiguous call; both ambiguous./(x: float, y: Time): Frequency and ambiguous./(x: float, y: Time): Radioactivity match for: (int literal(1), Time)
var fr: Frequency = 1 / Time(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment