Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: The power of strict typo-checking

by tmoertel (Chaplain)
on Nov 06, 2004 at 16:56 UTC ( #405783=note: print w/ replies, xml ) Need Help??


in reply to The power of strict typo-checking

The drawback is that operators have to be distinct by type: for example, "+." is used for floating-point addition and "+" for integer addition.
This drawback is not part of the general tradeoff that comes with type checking but rather is an artifact of certain implementations. For example, Haskell's type system supports type classes and does away with this limitation:
$ ghci ___ ___ _ / _ \ /\ /\/ __(_) / /_\// /_/ / / | | GHC Interactive, version 6.2.1, for Haskell 98. / /_\\/ __ / /___| | http://www.haskell.org/ghc/ \____/\/ /_/\____/|_| Type :? for help. Loading package base ... linking ... done. Prelude> :t (+) (+) :: forall a. (Num a) => a -> a -> a Prelude> 1 + 1 2 Prelude> 1.0 + 1.0 2.0 Prelude> :module +Ratio Prelude Ratio> 1%2 + 1%3 5 % 6

Cheers,
Tom


Comment on Re: The power of strict typo-checking
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://405783]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (12)
As of 2014-08-01 23:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (51 votes), past polls