Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • Here's another controversial one:

        Static typing without type inference

    If you're going to make a new language, please make a type-inferring version of C. kthxbye
    • Could you give an example of a language which avoids this regret?
      • by ziggy (25) on 2005.04.08 21:25 (#39516) Journal
        Haskell's static typing does pretty good inferencing.
        $ ghci
        Prelude> let sq x = x * x
        Prelude> :type sq
        sq :: forall a. (Num a) => a -> a
        That is, the function sq is defined for all values a, such that a is an instance of the type class Num. Remember, Haskell is strongly typed, and this function is defined on all kinds of numbers (machine integers, bignums, floats, doubles, complex, etc.). Furthermore, it will be defined on all types you define that are also instances of Num.

        This is a contrived example, but it does demonstrate type inference. That is, it avoids the Java problem where a function like sq needs to be redefined for every numeric type you want to square (primitive numbers and user defined numeric types). All with a single definition.