Why C# is not statically typed but F# and Haskell are?

There was a talk given by Brian Hurt about advantages and disadvantages of static typing.
Brian said that by static typing he don't mean C#, but F# and Haskell.
Is it because of dynamic keyword added
to C#-4.0? But this feature is relatively rarely useful. By the way, there are ⊥ and unsafeCoerse in
Haskell which obviously are not the same, but something that could blown your head off in runtime similarly like exception thrown as a result of dynamic.
Finally, why F# and Haskell could be named a statically typed languages and C# couldn't?

I'm addressing the overlap between Haskell and F#'s type systems. The part they share is known sometimes as System F. F# by necessity provides bits and pieces of C#'s type system, but this isn't what the speaker was talking about.
Both C# and Haskell/F# are statically typed, but they're two different flavors.
Subtyping
Specifically, C# is a statically typed language with subtyping. This means that if you look at the typing rules for C# there's one like
Env |- x : T, T' <: T
Env |- x : T'
Which means that any well typed term has more than one potential type. This in not the case in (vanilla) Haskell or F#. Every type has a single most general type, a principal type. This has a few benefits like total type inference.
Expressions Everywhere
Besides this, Haskell and F# have a greater emphasis on expressions, expressions have types, but statements don't. This means that in C#, the compiler is checking less of your code, because less of your code has types. In Haskell, everything has a real, checkable
type.
In substantive terms, every single node on a Haskell AST has a type or kind (or sort). The same cannot be said of a C# one.
Sum Types
Beyond this, Haskell and F# have what are known as sum types.
data Bool = True | False
This is how a boolean is defined in Haskell. This provides a few different guarantees than in C#. For example, when there are a discrete number of things in C#, like say, an AST. We can model this with an inheritance hierarchy, but these are open. Anyone can
come along and add something to it. We can use an Enum,
but then there's no sane way to attach data to each tag uniformly. This is what's called a tagged union, and it's up to you to implement/use it correctly, the compiler ain't gonna help.
This makes it very hard to ensure that we've covered all possible nodes of an AST. For example, say you have a function
doStuff :: AST -> AST
doStuff (SomeExpr ..) = ...
doStuff (SomeStatement ..) = ...
--// doStuff (SomeIf ...) = Oh noes, we forgot a node
The compiler can warn you because it can prove exactly how many nodes there are, ever. In C#, the equivalent would have to be done with downcasting, and then, since the set of nodes in our hierarchy is open, there's no way to issue compile time warnings.
A company, Jane Street, raves about how useful this feature is in their large OCaml code base. Watch a few of their talks,
they talk quite a bit about how using OCaml impacts them in the Real World.
Soapbox
Now I've outlined quite a few differences over System F over many mainstream type systems, but they're all still static type systems. It does bother me when people call Java/C#/C++ "not statically typed" they are. And they certainly give you
more compile time guarantees than say, Python. So it's a bit unfair to dismiss them out right.

Similar Messages

  • While soing private browsing, u say that it will not keep history but history and cookies are being saved. Why?

    I have already posed my question. I m having the latest version of Firefox and updated version of Windows 7 Professional.

    That can only be the cookies from the normal session that were saved automatically before entering PB mode and not new cookies. The same for the history. If that isn't happening then you may not be in PB mode ([https://support.mozilla.com/kb/Safe+Mode Safe Mode]). Cookies and history from before the PB mode session are not removed and will be restored from disk.

  • Why has canada not recieved the 3.2 update we are still on 3.1

    why has canada not recieved the 3.2 update we are still on 3.1

    Bump: No love for Canada
    The Canadian distro hasn't recieved a single update in the last 6 months. Just about every other country has recieved updates in the last month.
    What gives Lenovo?
    Yes, I know I can flash and get the US version (which I have) but, we shouldn't have to jump through hoops.

  • Why do iPhones/iPad not support Flash Player/Java and what are my alternatives for browsing sites using these plug-ins?

    Why do iPhones/iPad not support Flash Player/Java and what are my alternatives for browsing sites using these plug-ins?

    There are also iSwifter, Photon, Skyfire, etc., some only support Flash some support Java and Flash.
    Adobe never made a version of Flash for iOS and closed their mobile flash division a couple of years ago. You can get Flash on other personal devices but you will be using a 2 year old version that has not been patched for security vulnerabilities.
    When the original iPhone was released Mr. Jobs said it would never run Java as it was old technology and a security risk. Nothing has changed since.

  • I got my Iphone 3gs unlocked, but Navigation and Compass are not working. Please help if anybody had faced this problem and got it resolved.

    I got my Iphone 3gs unlocked, but Navigation and Compass are not working. Please help if anybody had faced this problem and got it resolved.

    Only the carrier that the iPhone was locked to can unlock. There you go, hacking void any support from this forum.

  • I have set up iCloud for my iPhone, iPod, and macbook but photos and music are not downloading...

    I have set up iCloud for my iPhone, iPod, and macbook but photos and music are not downloading...
    ICloud preferences have been checked, photo stream enabled on iphone-- what's missing?

    The version that came with Microsoft Office Home and Business 2010 and says Version 14.0.7106.5003 (32 Bit) and the e-mail I have set up as POP / SMTP.  Thanks for your reply.

  • HT4587 My airport express and wireless airplay speaker are connected to wife, but airplay and homesharing are not working...what to do?

    My airport express and wireless airplay speaker are connected to WIFI, but airplay and homesharing are not working...what to do?  Everything was working fine until about two weeks ago, all of the sudden airplay has disappeared from the iphone, itunes on the laptop, and the apple remote for iphone.  I have restarted the router many times, re-setup the airplay speaker and the airport express and booth are showing as being properly connected to the router when I log into the router IP address.  I was on the phone with Apple support for 30 minutes they blames verizon, got on the phone with verizon and they stated the settings were all correct and compatible with apple, got back on the phone with apple and they again are blaming verizon and trying to get me to get an airport extreme because that would fix the problem...any suggestions, please!

    There are three Airport resets, soft, hard and factory default.  It would probably be beneficial if you tried each one in sequence.  Actually, you could jump to the factory default reset if you don't mind reconfiguring from scratch.

  • HT1414 Why am I not able to text to phones that are not iPhones?  Nor am I able to receive text msg from phones other than iPhones

    Why am I not able to text to phones that are not iphones?
    Nor am I able to receive text messages from phones other than iphones.

    Settings-messages-send as SMS turned on?
    Have you tried settings-general-reset-reset network settings?
    Tried a reset?

  • Why Apple does not support from Iran? And why not open a store in Iran?

    Why Apple does not support from Iran? And why not open a store in Iran?

    You think this is an injustice?
    I think that injustice relates to rights that are not honored or respected, and I think we can agree that in no circumstance, human, civil, political or legal, is having or owning an Apple ID, or any other consumer item, a right.
    Why should this happen? ...Iraq ... Afghanistan....
    I believe that Apple, and most American companies, would love to have access to every market in the world, and Iran certainly (or at least, potentially) represents a larger market for Apple products than many countries in which they do business. So, given the choice, they'd be there.

  • I have an external hard drive that shows up in disk utility but Verify and Restore are greyed out.

    I have an external hard drive that shows up in disk utility but Verify and Restore are greyed out. I am trying to determine what is wrong with the drive.
    I need the data on the drive and it won't show up in Disk Warrior. I have tried different Mac's and different USB cords only to find the same outcome. When selected in Disk Utility the information read as such...
    Disk Description : WD Elements 1023 Media                      Total Capacity : 500.11 GB (500,105,740,288 Bytes)
    Connection Bus : USB                                                               Write Status : Read/Write
    Connection Type : External                                                     S.M.A.R.T. Status : Not Supported
    USB Serial Number : 575837314135304D36373132        Partition Map Scheme : Unformatted
    As the drive shows in Disk Utility there must be some life left in it surely. There is a possibilty that the physical connection between the USB cord and the external drive is damaged but since the drive shows up I believe it's unlikely... before I give it to the pro's is there anything else I can do to diagnose the issue?

    Hello,
    I have just experienced the same thing!
    Although my external drive shows in Disk Utility, it does not show in Finder.
    And the Verify/Repair buttons are also greyed out.
    Also, although the drive is 2TB. DU shows it as having Total Capacity of only 4.14GB! (Which should be the Free Space).
    I was wondering if you solved your problem, & if so, would you share your solution.
    I´m afraid to Erase in case I lose all my Data on the drive.
    Thanks in advance for your reply!

  • I bought an iphone 4 from my friend and he do not know his apple ID and we are trying to know the email attached to is apple ID so we can rest it cause he forgot them as well and the reset button in the 2 steps always says that the email is always sent !

    i bought an iphone 4 from my friend and he do not know his apple ID and we are trying to know the email attached to is apple ID so we can rest it cause he forgot them as well and the reset button in the 2 steps always says that the email is always sent ! ( even if you wrote a worng ID like ( asdasdasd ) it will say sent !! how come and now am trying to know or need a hint on that email so my freind could try to remember it !
    to those who will think that this phone is stolen , no its not and i would love to go to apple store if there is 1 in jordan so they can help us ,
    i have everything with this iphone the box the catalog its serial number , everything but the ID and the (and apple ID is everything as you know)
    so please if anyone have any suggestion to help me , and even apple it self if the can help me to get a support from them cause i tried everything to contact them by mail or any other option since as i said there is no apple store in jordan

    he knows his ID , if he did all whats in the link he can get his password back ?
    how can i make him call applecare ? is there a way to speak to them from jordan ??
    i have been trying to reach any1 in apple so they can communicate and help my friend (us) to make him remember it .
    am not asking for the password or trying to get into the phone without using it , and i can take my money back though i need to help my friend as well since now he cant use it as well.
    thanks kil

  • I change my apple id, so I deleted apps and downloaded again so I could update them but keynote and pages are expensive and I don't want to pay again for I pad and 2 laptops. Any suggestions?

    I change my apple ID and password. By doing that I was not able to update apps so I delete then and download them again. But keynote and pages are expensive.
    Is there any suggestions to send those apps to the new apple iD in iPad and 2 MacBooks ?

    Afraid not Hugo...  The apps purchased from one Apple ID account cannnot be transferred to another and accounts cannot be merged.
    Frequently asked questions about Apple ID

  • IMac indicating Password for Gmail is incorrect but iPhone and iPad are both able to connect to gmail account....how do I correct this on the iMac?

    iMac indicating Password for Gmail is incorrect but iPhone and iPad are both able to connect to gmail account....how do I correct this on the iMac?

    Try This:
    Open up the imessage app on your Imac.  Once you have it opened go to top left corner of your screen next to the apple picture and the word MESSAGES appears. Click on it then click on preferences and uncheck your husbands phone and number and or any other numbers which are checked. I had same problem this fixed it. Also if you wanted to you can open up your own Apple account, but that's not really necessary. My wife and I both share the same as you do

  • My MacBook Pro, running 10.7.3, does not recognize when my iPhone and iPad are on the same network, thus it does not synch.  Any ideas?

    My MacBook Pro, running 10.7.3, does not recognize when my iPhone and iPad are on the same network, thus it does not synch.  Any ideas?

    Try the basics first:
       Change your router channel number.  Most times this works & is all you have to do.
    Disconnect & reconnect your modem.  unplug it for about 10 seconds.  Plug it back in.  Do the same for Apple’s routers.  Wait for everything to reboot.
    System Preferences>Network
    Click the Assist Me button.
    In the next window that pops up, click the Diagnostic button & do the necessary.
    Research Knowledge Base for network problems that pertain to the OS that is currently installed on your computer.   See these basic networking KB Articles:  http://support.apple.com/kb/HT1401 AirPort troubleshooting guide
    http://support.apple.com/kb/HT2712 Using network locations in Mac OS X
    Manually provided DNS server addresses are higher priority than DHCP's
    http://support.apple.com/kb/HT1714 Solutions for connecting to the Internet, setting up a small network, and troubleshooting
    ============================
    What to do when you can't connect to the Internet
    Also, run the Airport Utility app which is located inside the Utilities folder.
    =====================
    If using a  Linksys router, contact LinkSys Customer Support and/or post in their forums.
    If using Apple's Airport, please re-post over in one of the AirPort Forums.

  • My device does not give clear audio. voice and music are defected

    my device (Compaq Presario CQ40-314TU Notebook PC)does not give clear audio. voice and music are defected 

    Ahh, yeah, that's probably what happened then. Once you re-enable your service, you should be all set.
    If you want to thank someone for their comment, do so by clicking the Thumbs Up icon.
    If your issue is resolved, don't forget to click the Solution button on the resolution!

Maybe you are looking for

  • How do I transfer my old IPAD onto my new IPAD

    I purchased a new IPAD Air and would like to transfer all of the data from my old IPAD 7.0.4 onto my new one. How do I do this?

  • Macbook Pro won't start up - Mountain Lion won't install

    Hello, I have a Macbook Pro from august 2012, today it just crashed. I tried to fix it with disk utility, but it told me that I need to reinstall Mountain Lion, because disk can't be fixed. I then tried to reinstall Mountain Lion but at first it didn

  • A Stylus Maybe for the Palm Pre...?

    I don't suffer from fat fingers, but maybe and accessory stylus could be fashioned. Maybe a new back plate with integrated stylus could be sold for current Pres or included in future ones. A nice weighty, metal stylus; no light weight plastic stylus

  • How can I restrict who connects with WPA?

    Our current network is using WPA with having the users get authenticated via the windows domain. Anyone with a domain login can use the same credentials to log in to the wireless network. Is there a way to keep some users from authenticating to the w

  • Tables: Controlling whether row strokes or column strokes appear on top

    I was hoping I could use Table Options > Table Setup: Stroke Drawing Order to globally affect whether row strokes or column strokes appear on top of one another as well as how the gap of double lines connect. But the results are not meeting my expect