Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: The power of strict typo-checking

by tmoertel (Chaplain)
on Nov 06, 2004 at 16:56 UTC ( [id://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

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2024-04-18 20:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found