[Haskell-cafe] Re: Overloading functions based on arguments?
wren ng thornton
wren at freegeek.org
Sun Feb 15 01:28:38 EST 2009
John A. De Goes wrote:
> On Feb 13, 2009, at 2:11 PM, Jonathan Cast wrote:
>> The compiler should fail when you tell it two mutually contradictory
>> things, and only when you tell it two mutually contradictory things.
>
> By definition, it's not a contradiction when the symbol is unambiguously
> typeable. Do you think math textbooks are filled with contradictions
> when they give '+' a different meaning for vectors than matrices or real
> numbers???
Yes. Yes, I do.
It is precisely this abuse of notation which makes, for instance,
statistics textbooks impossible to read (without already knowing the
material). Scalars, vectors, and matrices are fundamentally different
here and the operations on them should be unambiguous, regardless of
context. When reading a machine learning algorithm it should *never* be
a question whether something is scalar or not. Ambiguity is a bug.
Replacing one kind for another is almost always wrong.
For another example, consider matrices vs their transposes. Many folks
can't be bothered to type a single character to clarify when things
should be transposed before multiplying. No matter how quickly someone
can test the equation to verify it, leaving that information off makes
the equation simply wrong. And it's not as if square matrices aren't
ubiquitous.
--
Live well,
~wren
More information about the Haskell-Cafe
mailing list