Re: Static Typing in Python

From: Jacek Generowicz (jacek.generowicz_at_cern.ch)
Date: 03/19/04


Date: 19 Mar 2004 09:40:11 +0100

Donn Cave <donn@u.washington.edu> writes:

> Speaking of which, Haskell's type system supports type classes
> like Num (number), where Int and Float are instances of Num
> that implement its "+" function.

This is pretty much what you'd do in OCaml too, I believe.

> I'm probably leaving out a paragraph or two of the interesting
> parts, but the end result is that 1.5 + 1 works. Haskell is not
> weakly typed.

But the point is that the programmer conrols whether the automatic
conversion is done or not. In weakly typed languages you get the
conversion whether you want it or not.



Relevant Pages

  • Re: How about adding rational fraction to Python?
    ... which is a narrower class than Num but it could still be Float, Double, ... a list of fractionals. ... thing" for ints. ...
    (comp.lang.python)
  • Re: compare two float values
    ... (either float or double) ... num = rand; ... num = atof(fgets(cNum, sizeof cNum, stdin)); ...
    (comp.lang.c)
  • Re: Precision issue
    ... >reprfunction is for discovering, as precisely as possible, the actual ... a binary float can always be given a precise decimal ... I'm not sure if repr currently preserves the full precision of the ... num = int ...
    (comp.lang.python)
  • Re: sob..Someone can help me????plsss
    ... float num1,num2,num3,num4; ... if the first 5 characters are digits and the sixth is whitespace, ... Note that scanf doesn't touch num if ...
    (comp.lang.c)
  • Re: sob..Someone can help me????plsss
    ... main returns an int. ... float num1,num2,num3,num4; ... Note that scanf doesn't touch num if ... use scanf() unless there is no better choice. ...
    (comp.lang.c)