CINXE.COM
Type system - Wikipedia
<!DOCTYPE html> <html class="client-nojs vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-feature-night-mode-enabled skin-theme-clientpref-day vector-sticky-header-enabled vector-toc-available" lang="en" dir="ltr"> <head> <meta charset="UTF-8"> <title>Type system - Wikipedia</title> <script>(function(){var className="client-js vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-feature-night-mode-enabled skin-theme-clientpref-day vector-sticky-header-enabled vector-toc-available";var cookie=document.cookie.match(/(?:^|; )enwikimwclientpreferences=([^;]+)/);if(cookie){cookie[1].split('%2C').forEach(function(pref){className=className.replace(new RegExp('(^| )'+pref.replace(/-clientpref-\w+$|[^\w-]+/g,'')+'-clientpref-\\w+( |$)'),'$1'+pref+'$2');});}document.documentElement.className=className;}());RLCONF={"wgBreakFrames":false,"wgSeparatorTransformTable":["",""],"wgDigitTransformTable":["",""],"wgDefaultDateFormat":"dmy", "wgMonthNames":["","January","February","March","April","May","June","July","August","September","October","November","December"],"wgRequestId":"c9202f3a-968a-427e-a77a-71b268e6dad0","wgCanonicalNamespace":"","wgCanonicalSpecialPageName":false,"wgNamespaceNumber":0,"wgPageName":"Type_system","wgTitle":"Type system","wgCurRevisionId":1274970460,"wgRevisionId":1274970460,"wgArticleId":199701,"wgIsArticle":true,"wgIsRedirect":false,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":["Articles with short description","Short description is different from Wikidata","Articles lacking in-text citations from October 2010","All articles lacking in-text citations","Wikipedia articles with style issues from July 2016","All articles with style issues","All articles with specifically marked weasel-worded phrases","Articles with specifically marked weasel-worded phrases from July 2017","Articles with specifically marked weasel-worded phrases from November 2015", "All articles with unsourced statements","Articles with unsourced statements from November 2015","Wikipedia articles needing clarification from November 2015","Articles needing more detailed references","Articles with example C code","Articles with example Java code","Commons category link is on Wikidata","Type systems","Data types","Program analysis","Type theory"],"wgPageViewLanguage":"en","wgPageContentLanguage":"en","wgPageContentModel":"wikitext","wgRelevantPageName":"Type_system","wgRelevantArticleId":199701,"wgIsProbablyEditable":true,"wgRelevantPageIsProbablyEditable":true,"wgRestrictionEdit":[],"wgRestrictionMove":[],"wgRedirectedFrom":"Dynamically_typed","wgNoticeProject":"wikipedia","wgCiteReferencePreviewsActive":false,"wgFlaggedRevsParams":{"tags":{"status":{"levels":1}}},"wgMediaViewerOnClick":true,"wgMediaViewerEnabledByDefault":true,"wgPopupsFlags":0,"wgVisualEditor":{"pageLanguageCode":"en","pageLanguageDir":"ltr","pageVariantFallbacks":"en"}, "wgMFDisplayWikibaseDescriptions":{"search":true,"watchlist":true,"tagline":false,"nearby":true},"wgWMESchemaEditAttemptStepOversample":false,"wgWMEPageLength":60000,"wgInternalRedirectTargetUrl":"/wiki/Type_system#Dynamic_type_checking_and_runtime_type_information","wgEditSubmitButtonLabelPublish":true,"wgULSPosition":"interlanguage","wgULSisCompactLinksEnabled":false,"wgVector2022LanguageInHeader":true,"wgULSisLanguageSelectorEmpty":false,"wgWikibaseItemId":"Q865760","wgCheckUserClientHintsHeadersJsApi":["brands","architecture","bitness","fullVersionList","mobile","model","platform","platformVersion"],"GEHomepageSuggestedEditsEnableTopics":true,"wgGETopicsMatchModeEnabled":false,"wgGEStructuredTaskRejectionReasonTextInputEnabled":false,"wgGELevelingUpEnabledForUser":false};RLSTATE={"ext.globalCssJs.user.styles":"ready","site.styles":"ready","user.styles":"ready","ext.globalCssJs.user":"ready","user":"ready","user.options":"loading","ext.cite.styles":"ready","ext.pygments":"ready", "ext.math.styles":"ready","skins.vector.search.codex.styles":"ready","skins.vector.styles":"ready","skins.vector.icons":"ready","jquery.makeCollapsible.styles":"ready","ext.wikimediamessages.styles":"ready","ext.visualEditor.desktopArticleTarget.noscript":"ready","ext.uls.interlanguage":"ready","wikibase.client.init":"ready","ext.wikimediaBadges":"ready"};RLPAGEMODULES=["mediawiki.action.view.redirect","ext.cite.ux-enhancements","ext.pygments.view","ext.scribunto.logs","site","mediawiki.page.ready","jquery.makeCollapsible","mediawiki.toc","skins.vector.js","ext.centralNotice.geoIP","ext.centralNotice.startUp","ext.gadget.ReferenceTooltips","ext.gadget.switcher","ext.urlShortener.toolbar","ext.centralauth.centralautologin","mmv.bootstrap","ext.popups","ext.visualEditor.desktopArticleTarget.init","ext.visualEditor.targetLoader","ext.echo.centralauth","ext.eventLogging","ext.wikimediaEvents","ext.navigationTiming","ext.uls.interface","ext.cx.eventlogging.campaigns", "ext.cx.uls.quick.actions","wikibase.client.vector-2022","ext.checkUser.clientHints","ext.growthExperiments.SuggestedEditSession"];</script> <script>(RLQ=window.RLQ||[]).push(function(){mw.loader.impl(function(){return["user.options@12s5i",function($,jQuery,require,module){mw.user.tokens.set({"patrolToken":"+\\","watchToken":"+\\","csrfToken":"+\\"}); }];});});</script> <link rel="stylesheet" href="/w/load.php?lang=en&modules=ext.cite.styles%7Cext.math.styles%7Cext.pygments%2CwikimediaBadges%7Cext.uls.interlanguage%7Cext.visualEditor.desktopArticleTarget.noscript%7Cext.wikimediamessages.styles%7Cjquery.makeCollapsible.styles%7Cskins.vector.icons%2Cstyles%7Cskins.vector.search.codex.styles%7Cwikibase.client.init&only=styles&skin=vector-2022"> <script async="" src="/w/load.php?lang=en&modules=startup&only=scripts&raw=1&skin=vector-2022"></script> <meta name="ResourceLoaderDynamicStyles" content=""> <link rel="stylesheet" href="/w/load.php?lang=en&modules=site.styles&only=styles&skin=vector-2022"> <meta name="generator" content="MediaWiki 1.44.0-wmf.17"> <meta name="referrer" content="origin"> <meta name="referrer" content="origin-when-cross-origin"> <meta name="robots" content="max-image-preview:standard"> <meta name="format-detection" content="telephone=no"> <meta name="viewport" content="width=1120"> <meta property="og:title" content="Type system - Wikipedia"> <meta property="og:type" content="website"> <link rel="preconnect" href="//upload.wikimedia.org"> <link rel="alternate" media="only screen and (max-width: 640px)" href="//en.m.wikipedia.org/wiki/Type_system#Dynamic_type_checking_and_runtime_type_information"> <link rel="alternate" type="application/x-wiki" title="Edit this page" href="/w/index.php?title=Type_system&action=edit"> <link rel="apple-touch-icon" href="/static/apple-touch/wikipedia.png"> <link rel="icon" href="/static/favicon/wikipedia.ico"> <link rel="search" type="application/opensearchdescription+xml" href="/w/rest.php/v1/search" title="Wikipedia (en)"> <link rel="EditURI" type="application/rsd+xml" href="//en.wikipedia.org/w/api.php?action=rsd"> <link rel="canonical" href="https://en.wikipedia.org/wiki/Type_system#Dynamic_type_checking_and_runtime_type_information"> <link rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en"> <link rel="alternate" type="application/atom+xml" title="Wikipedia Atom feed" href="/w/index.php?title=Special:RecentChanges&feed=atom"> <link rel="dns-prefetch" href="//meta.wikimedia.org" /> <link rel="dns-prefetch" href="login.wikimedia.org"> </head> <body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject mw-editable page-Type_system rootpage-Type_system skin-vector-2022 action-view"><a class="mw-jump-link" href="#bodyContent">Jump to content</a> <div class="vector-header-container"> <header class="vector-header mw-header"> <div class="vector-header-start"> <nav class="vector-main-menu-landmark" aria-label="Site"> <div id="vector-main-menu-dropdown" class="vector-dropdown vector-main-menu-dropdown vector-button-flush-left vector-button-flush-right" title="Main menu" > <input type="checkbox" id="vector-main-menu-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-main-menu-dropdown" class="vector-dropdown-checkbox " aria-label="Main menu" > <label id="vector-main-menu-dropdown-label" for="vector-main-menu-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-menu mw-ui-icon-wikimedia-menu"></span> <span class="vector-dropdown-label-text">Main menu</span> </label> <div class="vector-dropdown-content"> <div id="vector-main-menu-unpinned-container" class="vector-unpinned-container"> <div id="vector-main-menu" class="vector-main-menu vector-pinnable-element"> <div class="vector-pinnable-header vector-main-menu-pinnable-header vector-pinnable-header-unpinned" data-feature-name="main-menu-pinned" data-pinnable-element-id="vector-main-menu" data-pinned-container-id="vector-main-menu-pinned-container" data-unpinned-container-id="vector-main-menu-unpinned-container" > <div class="vector-pinnable-header-label">Main menu</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-main-menu.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-main-menu.unpin">hide</button> </div> <div id="p-navigation" class="vector-menu mw-portlet mw-portlet-navigation" > <div class="vector-menu-heading"> Navigation </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-mainpage-description" class="mw-list-item"><a href="/wiki/Main_Page" title="Visit the main page [z]" accesskey="z"><span>Main page</span></a></li><li id="n-contents" class="mw-list-item"><a href="/wiki/Wikipedia:Contents" title="Guides to browsing Wikipedia"><span>Contents</span></a></li><li id="n-currentevents" class="mw-list-item"><a href="/wiki/Portal:Current_events" title="Articles related to current events"><span>Current events</span></a></li><li id="n-randompage" class="mw-list-item"><a href="/wiki/Special:Random" title="Visit a randomly selected article [x]" accesskey="x"><span>Random article</span></a></li><li id="n-aboutsite" class="mw-list-item"><a href="/wiki/Wikipedia:About" title="Learn about Wikipedia and how it works"><span>About Wikipedia</span></a></li><li id="n-contactpage" class="mw-list-item"><a href="//en.wikipedia.org/wiki/Wikipedia:Contact_us" title="How to contact Wikipedia"><span>Contact us</span></a></li> </ul> </div> </div> <div id="p-interaction" class="vector-menu mw-portlet mw-portlet-interaction" > <div class="vector-menu-heading"> Contribute </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-help" class="mw-list-item"><a href="/wiki/Help:Contents" title="Guidance on how to use and edit Wikipedia"><span>Help</span></a></li><li id="n-introduction" class="mw-list-item"><a href="/wiki/Help:Introduction" title="Learn how to edit Wikipedia"><span>Learn to edit</span></a></li><li id="n-portal" class="mw-list-item"><a href="/wiki/Wikipedia:Community_portal" title="The hub for editors"><span>Community portal</span></a></li><li id="n-recentchanges" class="mw-list-item"><a href="/wiki/Special:RecentChanges" title="A list of recent changes to Wikipedia [r]" accesskey="r"><span>Recent changes</span></a></li><li id="n-upload" class="mw-list-item"><a href="/wiki/Wikipedia:File_upload_wizard" title="Add images or other media for use on Wikipedia"><span>Upload file</span></a></li><li id="n-specialpages" class="mw-list-item"><a href="/wiki/Special:SpecialPages"><span>Special pages</span></a></li> </ul> </div> </div> </div> </div> </div> </div> </nav> <a href="/wiki/Main_Page" class="mw-logo"> <img class="mw-logo-icon" src="/static/images/icons/wikipedia.png" alt="" aria-hidden="true" height="50" width="50"> <span class="mw-logo-container skin-invert"> <img class="mw-logo-wordmark" alt="Wikipedia" src="/static/images/mobile/copyright/wikipedia-wordmark-en.svg" style="width: 7.5em; height: 1.125em;"> <img class="mw-logo-tagline" alt="The Free Encyclopedia" src="/static/images/mobile/copyright/wikipedia-tagline-en.svg" width="117" height="13" style="width: 7.3125em; height: 0.8125em;"> </span> </a> </div> <div class="vector-header-end"> <div id="p-search" role="search" class="vector-search-box-vue vector-search-box-collapses vector-search-box-show-thumbnail vector-search-box-auto-expand-width vector-search-box"> <a href="/wiki/Special:Search" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only search-toggle" title="Search Wikipedia [f]" accesskey="f"><span class="vector-icon mw-ui-icon-search mw-ui-icon-wikimedia-search"></span> <span>Search</span> </a> <div class="vector-typeahead-search-container"> <div class="cdx-typeahead-search cdx-typeahead-search--show-thumbnail cdx-typeahead-search--auto-expand-width"> <form action="/w/index.php" id="searchform" class="cdx-search-input cdx-search-input--has-end-button"> <div id="simpleSearch" class="cdx-search-input__input-wrapper" data-search-loc="header-moved"> <div class="cdx-text-input cdx-text-input--has-start-icon"> <input class="cdx-text-input__input" type="search" name="search" placeholder="Search Wikipedia" aria-label="Search Wikipedia" autocapitalize="sentences" title="Search Wikipedia [f]" accesskey="f" id="searchInput" > <span class="cdx-text-input__icon cdx-text-input__start-icon"></span> </div> <input type="hidden" name="title" value="Special:Search"> </div> <button class="cdx-button cdx-search-input__end-button">Search</button> </form> </div> </div> </div> <nav class="vector-user-links vector-user-links-wide" aria-label="Personal tools"> <div class="vector-user-links-main"> <div id="p-vector-user-menu-preferences" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <div id="p-vector-user-menu-userpage" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <nav class="vector-appearance-landmark" aria-label="Appearance"> <div id="vector-appearance-dropdown" class="vector-dropdown " title="Change the appearance of the page's font size, width, and color" > <input type="checkbox" id="vector-appearance-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-appearance-dropdown" class="vector-dropdown-checkbox " aria-label="Appearance" > <label id="vector-appearance-dropdown-label" for="vector-appearance-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-appearance mw-ui-icon-wikimedia-appearance"></span> <span class="vector-dropdown-label-text">Appearance</span> </label> <div class="vector-dropdown-content"> <div id="vector-appearance-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <div id="p-vector-user-menu-notifications" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <div id="p-vector-user-menu-overflow" class="vector-menu mw-portlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-sitesupport-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="https://donate.wikimedia.org/?wmf_source=donate&wmf_medium=sidebar&wmf_campaign=en.wikipedia.org&uselang=en" class=""><span>Donate</span></a> </li> <li id="pt-createaccount-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="/w/index.php?title=Special:CreateAccount&returnto=Type+system" title="You are encouraged to create an account and log in; however, it is not mandatory" class=""><span>Create account</span></a> </li> <li id="pt-login-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="/w/index.php?title=Special:UserLogin&returnto=Type+system" title="You're encouraged to log in; however, it's not mandatory. [o]" accesskey="o" class=""><span>Log in</span></a> </li> </ul> </div> </div> </div> <div id="vector-user-links-dropdown" class="vector-dropdown vector-user-menu vector-button-flush-right vector-user-menu-logged-out" title="Log in and more options" > <input type="checkbox" id="vector-user-links-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-user-links-dropdown" class="vector-dropdown-checkbox " aria-label="Personal tools" > <label id="vector-user-links-dropdown-label" for="vector-user-links-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-ellipsis mw-ui-icon-wikimedia-ellipsis"></span> <span class="vector-dropdown-label-text">Personal tools</span> </label> <div class="vector-dropdown-content"> <div id="p-personal" class="vector-menu mw-portlet mw-portlet-personal user-links-collapsible-item" title="User menu" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-sitesupport" class="user-links-collapsible-item mw-list-item"><a href="https://donate.wikimedia.org/?wmf_source=donate&wmf_medium=sidebar&wmf_campaign=en.wikipedia.org&uselang=en"><span>Donate</span></a></li><li id="pt-createaccount" class="user-links-collapsible-item mw-list-item"><a href="/w/index.php?title=Special:CreateAccount&returnto=Type+system" title="You are encouraged to create an account and log in; however, it is not mandatory"><span class="vector-icon mw-ui-icon-userAdd mw-ui-icon-wikimedia-userAdd"></span> <span>Create account</span></a></li><li id="pt-login" class="user-links-collapsible-item mw-list-item"><a href="/w/index.php?title=Special:UserLogin&returnto=Type+system" title="You're encouraged to log in; however, it's not mandatory. [o]" accesskey="o"><span class="vector-icon mw-ui-icon-logIn mw-ui-icon-wikimedia-logIn"></span> <span>Log in</span></a></li> </ul> </div> </div> <div id="p-user-menu-anon-editor" class="vector-menu mw-portlet mw-portlet-user-menu-anon-editor" > <div class="vector-menu-heading"> Pages for logged out editors <a href="/wiki/Help:Introduction" aria-label="Learn more about editing"><span>learn more</span></a> </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-anoncontribs" class="mw-list-item"><a href="/wiki/Special:MyContributions" title="A list of edits made from this IP address [y]" accesskey="y"><span>Contributions</span></a></li><li id="pt-anontalk" class="mw-list-item"><a href="/wiki/Special:MyTalk" title="Discussion about edits from this IP address [n]" accesskey="n"><span>Talk</span></a></li> </ul> </div> </div> </div> </div> </nav> </div> </header> </div> <div class="mw-page-container"> <div class="mw-page-container-inner"> <div class="vector-sitenotice-container"> <div id="siteNotice"><!-- CentralNotice --></div> </div> <div class="vector-column-start"> <div class="vector-main-menu-container"> <div id="mw-navigation"> <nav id="mw-panel" class="vector-main-menu-landmark" aria-label="Site"> <div id="vector-main-menu-pinned-container" class="vector-pinned-container"> </div> </nav> </div> </div> <div class="vector-sticky-pinned-container"> <nav id="mw-panel-toc" aria-label="Contents" data-event-name="ui.sidebar-toc" class="mw-table-of-contents-container vector-toc-landmark"> <div id="vector-toc-pinned-container" class="vector-pinned-container"> <div id="vector-toc" class="vector-toc vector-pinnable-element"> <div class="vector-pinnable-header vector-toc-pinnable-header vector-pinnable-header-pinned" data-feature-name="toc-pinned" data-pinnable-element-id="vector-toc" > <h2 class="vector-pinnable-header-label">Contents</h2> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-toc.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-toc.unpin">hide</button> </div> <ul class="vector-toc-contents" id="mw-panel-toc-list"> <li id="toc-mw-content-text" class="vector-toc-list-item vector-toc-level-1"> <a href="#" class="vector-toc-link"> <div class="vector-toc-text">(Top)</div> </a> </li> <li id="toc-Usage_overview" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Usage_overview"> <div class="vector-toc-text"> <span class="vector-toc-numb">1</span> <span>Usage overview</span> </div> </a> <ul id="toc-Usage_overview-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Fundamentals" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Fundamentals"> <div class="vector-toc-text"> <span class="vector-toc-numb">2</span> <span>Fundamentals</span> </div> </a> <button aria-controls="toc-Fundamentals-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>Toggle Fundamentals subsection</span> </button> <ul id="toc-Fundamentals-sublist" class="vector-toc-list"> <li id="toc-Type_errors" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Type_errors"> <div class="vector-toc-text"> <span class="vector-toc-numb">2.1</span> <span>Type errors</span> </div> </a> <ul id="toc-Type_errors-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Type_checking" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Type_checking"> <div class="vector-toc-text"> <span class="vector-toc-numb">3</span> <span>Type checking</span> </div> </a> <button aria-controls="toc-Type_checking-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>Toggle Type checking subsection</span> </button> <ul id="toc-Type_checking-sublist" class="vector-toc-list"> <li id="toc-Static_type_checking" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Static_type_checking"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.1</span> <span>Static type checking</span> </div> </a> <ul id="toc-Static_type_checking-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Dynamic_type_checking_and_runtime_type_information" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Dynamic_type_checking_and_runtime_type_information"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.2</span> <span>Dynamic type checking and runtime type information</span> </div> </a> <ul id="toc-Dynamic_type_checking_and_runtime_type_information-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Combining_static_and_dynamic_type_checking" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Combining_static_and_dynamic_type_checking"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.3</span> <span>Combining static and dynamic type checking</span> </div> </a> <ul id="toc-Combining_static_and_dynamic_type_checking-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Static_and_dynamic_type_checking_in_practice" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Static_and_dynamic_type_checking_in_practice"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.4</span> <span>Static and dynamic type checking in practice</span> </div> </a> <ul id="toc-Static_and_dynamic_type_checking_in_practice-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Strong_and_weak_type_systems" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Strong_and_weak_type_systems"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.5</span> <span>Strong and weak type systems</span> </div> </a> <ul id="toc-Strong_and_weak_type_systems-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Type_safety_and_memory_safety" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Type_safety_and_memory_safety"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.6</span> <span>Type safety and memory safety</span> </div> </a> <ul id="toc-Type_safety_and_memory_safety-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Variable_levels_of_type_checking" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Variable_levels_of_type_checking"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.7</span> <span>Variable levels of type checking</span> </div> </a> <ul id="toc-Variable_levels_of_type_checking-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Optional_type_systems" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Optional_type_systems"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.8</span> <span>Optional type systems</span> </div> </a> <ul id="toc-Optional_type_systems-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Polymorphism_and_types" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Polymorphism_and_types"> <div class="vector-toc-text"> <span class="vector-toc-numb">4</span> <span>Polymorphism and types</span> </div> </a> <ul id="toc-Polymorphism_and_types-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Specialized_type_systems" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Specialized_type_systems"> <div class="vector-toc-text"> <span class="vector-toc-numb">5</span> <span>Specialized type systems</span> </div> </a> <button aria-controls="toc-Specialized_type_systems-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>Toggle Specialized type systems subsection</span> </button> <ul id="toc-Specialized_type_systems-sublist" class="vector-toc-list"> <li id="toc-Dependent_types" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Dependent_types"> <div class="vector-toc-text"> <span class="vector-toc-numb">5.1</span> <span>Dependent types</span> </div> </a> <ul id="toc-Dependent_types-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Linear_types" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Linear_types"> <div class="vector-toc-text"> <span class="vector-toc-numb">5.2</span> <span>Linear types</span> </div> </a> <ul id="toc-Linear_types-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Intersection_types" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Intersection_types"> <div class="vector-toc-text"> <span class="vector-toc-numb">5.3</span> <span>Intersection types</span> </div> </a> <ul id="toc-Intersection_types-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Union_types" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Union_types"> <div class="vector-toc-text"> <span class="vector-toc-numb">5.4</span> <span>Union types</span> </div> </a> <ul id="toc-Union_types-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Existential_types" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Existential_types"> <div class="vector-toc-text"> <span class="vector-toc-numb">5.5</span> <span>Existential types</span> </div> </a> <ul id="toc-Existential_types-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Gradual_typing" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Gradual_typing"> <div class="vector-toc-text"> <span class="vector-toc-numb">5.6</span> <span>Gradual typing</span> </div> </a> <ul id="toc-Gradual_typing-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Explicit_or_implicit_declaration_and_inference" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Explicit_or_implicit_declaration_and_inference"> <div class="vector-toc-text"> <span class="vector-toc-numb">6</span> <span>Explicit or implicit declaration and inference</span> </div> </a> <ul id="toc-Explicit_or_implicit_declaration_and_inference-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Decision_problems" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Decision_problems"> <div class="vector-toc-text"> <span class="vector-toc-numb">7</span> <span>Decision problems</span> </div> </a> <ul id="toc-Decision_problems-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Unified_type_system" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Unified_type_system"> <div class="vector-toc-text"> <span class="vector-toc-numb">8</span> <span>Unified type system</span> </div> </a> <ul id="toc-Unified_type_system-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Compatibility:_equivalence_and_subtyping" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Compatibility:_equivalence_and_subtyping"> <div class="vector-toc-text"> <span class="vector-toc-numb">9</span> <span>Compatibility: equivalence and subtyping</span> </div> </a> <ul id="toc-Compatibility:_equivalence_and_subtyping-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-See_also" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#See_also"> <div class="vector-toc-text"> <span class="vector-toc-numb">10</span> <span>See also</span> </div> </a> <ul id="toc-See_also-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Notes" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Notes"> <div class="vector-toc-text"> <span class="vector-toc-numb">11</span> <span>Notes</span> </div> </a> <ul id="toc-Notes-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-References" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#References"> <div class="vector-toc-text"> <span class="vector-toc-numb">12</span> <span>References</span> </div> </a> <ul id="toc-References-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Further_reading" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Further_reading"> <div class="vector-toc-text"> <span class="vector-toc-numb">13</span> <span>Further reading</span> </div> </a> <ul id="toc-Further_reading-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-External_links" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#External_links"> <div class="vector-toc-text"> <span class="vector-toc-numb">14</span> <span>External links</span> </div> </a> <ul id="toc-External_links-sublist" class="vector-toc-list"> </ul> </li> </ul> </div> </div> </nav> </div> </div> <div class="mw-content-container"> <main id="content" class="mw-body"> <header class="mw-body-header vector-page-titlebar"> <nav aria-label="Contents" class="vector-toc-landmark"> <div id="vector-page-titlebar-toc" class="vector-dropdown vector-page-titlebar-toc vector-button-flush-left" title="Table of Contents" > <input type="checkbox" id="vector-page-titlebar-toc-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-page-titlebar-toc" class="vector-dropdown-checkbox " aria-label="Toggle the table of contents" > <label id="vector-page-titlebar-toc-label" for="vector-page-titlebar-toc-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-listBullet mw-ui-icon-wikimedia-listBullet"></span> <span class="vector-dropdown-label-text">Toggle the table of contents</span> </label> <div class="vector-dropdown-content"> <div id="vector-page-titlebar-toc-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <h1 id="firstHeading" class="firstHeading mw-first-heading"><span class="mw-page-title-main">Type system</span></h1> <div id="p-lang-btn" class="vector-dropdown mw-portlet mw-portlet-lang" > <input type="checkbox" id="p-lang-btn-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-p-lang-btn" class="vector-dropdown-checkbox mw-interlanguage-selector" aria-label="Go to an article in another language. Available in 31 languages" > <label id="p-lang-btn-label" for="p-lang-btn-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--action-progressive mw-portlet-lang-heading-31" aria-hidden="true" ><span class="vector-icon mw-ui-icon-language-progressive mw-ui-icon-wikimedia-language-progressive"></span> <span class="vector-dropdown-label-text">31 languages</span> </label> <div class="vector-dropdown-content"> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li class="interlanguage-link interwiki-ar mw-list-item"><a href="https://ar.wikipedia.org/wiki/%D9%86%D8%B8%D8%A7%D9%85_%D8%A7%D9%84%D8%A3%D9%86%D9%88%D8%A7%D8%B9" title="نظام الأنواع – Arabic" lang="ar" hreflang="ar" data-title="نظام الأنواع" data-language-autonym="العربية" data-language-local-name="Arabic" class="interlanguage-link-target"><span>العربية</span></a></li><li class="interlanguage-link interwiki-bn mw-list-item"><a href="https://bn.wikipedia.org/wiki/%E0%A6%9F%E0%A6%BE%E0%A6%87%E0%A6%AA_%E0%A6%AC%E0%A7%8D%E0%A6%AF%E0%A6%AC%E0%A6%B8%E0%A7%8D%E0%A6%A5%E0%A6%BE" title="টাইপ ব্যবস্থা – Bangla" lang="bn" hreflang="bn" data-title="টাইপ ব্যবস্থা" data-language-autonym="বাংলা" data-language-local-name="Bangla" class="interlanguage-link-target"><span>বাংলা</span></a></li><li class="interlanguage-link interwiki-be-x-old mw-list-item"><a href="https://be-tarask.wikipedia.org/wiki/%D0%A1%D1%8B%D1%81%D1%82%D1%8D%D0%BC%D0%B0_%D1%82%D1%8B%D0%BF%D0%B0%D1%9E" title="Сыстэма тыпаў – Belarusian (Taraškievica orthography)" lang="be-tarask" hreflang="be-tarask" data-title="Сыстэма тыпаў" data-language-autonym="Беларуская (тарашкевіца)" data-language-local-name="Belarusian (Taraškievica orthography)" class="interlanguage-link-target"><span>Беларуская (тарашкевіца)</span></a></li><li class="interlanguage-link interwiki-bg mw-list-item"><a href="https://bg.wikipedia.org/wiki/%D0%A2%D0%B8%D0%BF%D0%B8%D0%B7%D0%B0%D1%86%D0%B8%D1%8F_%D0%BD%D0%B0_%D0%B4%D0%B0%D0%BD%D0%BD%D0%B8%D1%82%D0%B5" title="Типизация на данните – Bulgarian" lang="bg" hreflang="bg" data-title="Типизация на данните" data-language-autonym="Български" data-language-local-name="Bulgarian" class="interlanguage-link-target"><span>Български</span></a></li><li class="interlanguage-link interwiki-bs mw-list-item"><a href="https://bs.wikipedia.org/wiki/Sistem_tipova" title="Sistem tipova – Bosnian" lang="bs" hreflang="bs" data-title="Sistem tipova" data-language-autonym="Bosanski" data-language-local-name="Bosnian" class="interlanguage-link-target"><span>Bosanski</span></a></li><li class="interlanguage-link interwiki-cs mw-list-item"><a href="https://cs.wikipedia.org/wiki/Typov%C3%BD_syst%C3%A9m" title="Typový systém – Czech" lang="cs" hreflang="cs" data-title="Typový systém" data-language-autonym="Čeština" data-language-local-name="Czech" class="interlanguage-link-target"><span>Čeština</span></a></li><li class="interlanguage-link interwiki-de mw-list-item"><a href="https://de.wikipedia.org/wiki/Typisierung_(Informatik)" title="Typisierung (Informatik) – German" lang="de" hreflang="de" data-title="Typisierung (Informatik)" data-language-autonym="Deutsch" data-language-local-name="German" class="interlanguage-link-target"><span>Deutsch</span></a></li><li class="interlanguage-link interwiki-el mw-list-item"><a href="https://el.wikipedia.org/wiki/%CE%A3%CF%8D%CF%83%CF%84%CE%B7%CE%BC%CE%B1_%CF%84%CF%8D%CF%80%CF%89%CE%BD" title="Σύστημα τύπων – Greek" lang="el" hreflang="el" data-title="Σύστημα τύπων" data-language-autonym="Ελληνικά" data-language-local-name="Greek" class="interlanguage-link-target"><span>Ελληνικά</span></a></li><li class="interlanguage-link interwiki-es mw-list-item"><a href="https://es.wikipedia.org/wiki/Sistema_de_tipos" title="Sistema de tipos – Spanish" lang="es" hreflang="es" data-title="Sistema de tipos" data-language-autonym="Español" data-language-local-name="Spanish" class="interlanguage-link-target"><span>Español</span></a></li><li class="interlanguage-link interwiki-fa mw-list-item"><a href="https://fa.wikipedia.org/wiki/%D8%B3%DB%8C%D8%B3%D8%AA%D9%85_%D9%86%D9%88%D8%B9" title="سیستم نوع – Persian" lang="fa" hreflang="fa" data-title="سیستم نوع" data-language-autonym="فارسی" data-language-local-name="Persian" class="interlanguage-link-target"><span>فارسی</span></a></li><li class="interlanguage-link interwiki-ko mw-list-item"><a href="https://ko.wikipedia.org/wiki/%EC%9E%90%EB%A3%8C%ED%98%95_%EC%B2%B4%EA%B3%84" title="자료형 체계 – Korean" lang="ko" hreflang="ko" data-title="자료형 체계" data-language-autonym="한국어" data-language-local-name="Korean" class="interlanguage-link-target"><span>한국어</span></a></li><li class="interlanguage-link interwiki-it mw-list-item"><a href="https://it.wikipedia.org/wiki/Sistema_dei_tipi" title="Sistema dei tipi – Italian" lang="it" hreflang="it" data-title="Sistema dei tipi" data-language-autonym="Italiano" data-language-local-name="Italian" class="interlanguage-link-target"><span>Italiano</span></a></li><li class="interlanguage-link interwiki-he mw-list-item"><a href="https://he.wikipedia.org/wiki/%D7%9E%D7%A2%D7%A8%D7%9B%D7%AA_%D7%98%D7%99%D7%A4%D7%95%D7%A1%D7%99%D7%9D" title="מערכת טיפוסים – Hebrew" lang="he" hreflang="he" data-title="מערכת טיפוסים" data-language-autonym="עברית" data-language-local-name="Hebrew" class="interlanguage-link-target"><span>עברית</span></a></li><li class="interlanguage-link interwiki-ky mw-list-item"><a href="https://ky.wikipedia.org/wiki/%D0%A2%D0%B8%D0%BF%D1%82%D0%B5%D1%88%D1%82%D0%B8%D1%80%D2%AF%D2%AF" title="Типтештирүү – Kyrgyz" lang="ky" hreflang="ky" data-title="Типтештирүү" data-language-autonym="Кыргызча" data-language-local-name="Kyrgyz" class="interlanguage-link-target"><span>Кыргызча</span></a></li><li class="interlanguage-link interwiki-ml mw-list-item"><a href="https://ml.wikipedia.org/wiki/%E0%B4%9F%E0%B5%88%E0%B4%AA%E0%B5%8D%E0%B4%AA%E0%B5%8D_%E0%B4%B8%E0%B4%BF%E0%B4%B8%E0%B5%8D%E0%B4%B1%E0%B5%8D%E0%B4%B1%E0%B4%82" title="ടൈപ്പ് സിസ്റ്റം – Malayalam" lang="ml" hreflang="ml" data-title="ടൈപ്പ് സിസ്റ്റം" data-language-autonym="മലയാളം" data-language-local-name="Malayalam" class="interlanguage-link-target"><span>മലയാളം</span></a></li><li class="interlanguage-link interwiki-ms mw-list-item"><a href="https://ms.wikipedia.org/wiki/Sistem_jenis" title="Sistem jenis – Malay" lang="ms" hreflang="ms" data-title="Sistem jenis" data-language-autonym="Bahasa Melayu" data-language-local-name="Malay" class="interlanguage-link-target"><span>Bahasa Melayu</span></a></li><li class="interlanguage-link interwiki-nl mw-list-item"><a href="https://nl.wikipedia.org/wiki/Typesysteem" title="Typesysteem – Dutch" lang="nl" hreflang="nl" data-title="Typesysteem" data-language-autonym="Nederlands" data-language-local-name="Dutch" class="interlanguage-link-target"><span>Nederlands</span></a></li><li class="interlanguage-link interwiki-ja mw-list-item"><a href="https://ja.wikipedia.org/wiki/%E5%9E%8B%E3%82%B7%E3%82%B9%E3%83%86%E3%83%A0" title="型システム – Japanese" lang="ja" hreflang="ja" data-title="型システム" data-language-autonym="日本語" data-language-local-name="Japanese" class="interlanguage-link-target"><span>日本語</span></a></li><li class="interlanguage-link interwiki-mhr mw-list-item"><a href="https://mhr.wikipedia.org/wiki/%D0%AB%D2%A5%D0%BF%D0%B0%D0%BB%D1%8B%D0%BD_%D1%82%D0%B8%D0%BF%D1%88%D0%B5" title="Ыҥпалын типше – Eastern Mari" lang="mhr" hreflang="mhr" data-title="Ыҥпалын типше" data-language-autonym="Олык марий" data-language-local-name="Eastern Mari" class="interlanguage-link-target"><span>Олык марий</span></a></li><li class="interlanguage-link interwiki-pl mw-list-item"><a href="https://pl.wikipedia.org/wiki/System_typ%C3%B3w" title="System typów – Polish" lang="pl" hreflang="pl" data-title="System typów" data-language-autonym="Polski" data-language-local-name="Polish" class="interlanguage-link-target"><span>Polski</span></a></li><li class="interlanguage-link interwiki-pt mw-list-item"><a href="https://pt.wikipedia.org/wiki/Sistema_de_tipos" title="Sistema de tipos – Portuguese" lang="pt" hreflang="pt" data-title="Sistema de tipos" data-language-autonym="Português" data-language-local-name="Portuguese" class="interlanguage-link-target"><span>Português</span></a></li><li class="interlanguage-link interwiki-ru mw-list-item"><a href="https://ru.wikipedia.org/wiki/%D0%A1%D0%B8%D1%81%D1%82%D0%B5%D0%BC%D0%B0_%D1%82%D0%B8%D0%BF%D0%BE%D0%B2" title="Система типов – Russian" lang="ru" hreflang="ru" data-title="Система типов" data-language-autonym="Русский" data-language-local-name="Russian" class="interlanguage-link-target"><span>Русский</span></a></li><li class="interlanguage-link interwiki-sq mw-list-item"><a href="https://sq.wikipedia.org/wiki/Sistemi_i_tipit" title="Sistemi i tipit – Albanian" lang="sq" hreflang="sq" data-title="Sistemi i tipit" data-language-autonym="Shqip" data-language-local-name="Albanian" class="interlanguage-link-target"><span>Shqip</span></a></li><li class="interlanguage-link interwiki-sr mw-list-item"><a href="https://sr.wikipedia.org/wiki/%D0%A1%D0%B8%D1%81%D1%82%D0%B5%D0%BC_%D1%82%D0%B8%D0%BF%D0%BE%D0%B2%D0%B0" title="Систем типова – Serbian" lang="sr" hreflang="sr" data-title="Систем типова" data-language-autonym="Српски / srpski" data-language-local-name="Serbian" class="interlanguage-link-target"><span>Српски / srpski</span></a></li><li class="interlanguage-link interwiki-fi mw-list-item"><a href="https://fi.wikipedia.org/wiki/Tyyppij%C3%A4rjestelm%C3%A4" title="Tyyppijärjestelmä – Finnish" lang="fi" hreflang="fi" data-title="Tyyppijärjestelmä" data-language-autonym="Suomi" data-language-local-name="Finnish" class="interlanguage-link-target"><span>Suomi</span></a></li><li class="interlanguage-link interwiki-sv mw-list-item"><a href="https://sv.wikipedia.org/wiki/Typsystem" title="Typsystem – Swedish" lang="sv" hreflang="sv" data-title="Typsystem" data-language-autonym="Svenska" data-language-local-name="Swedish" class="interlanguage-link-target"><span>Svenska</span></a></li><li class="interlanguage-link interwiki-th mw-list-item"><a href="https://th.wikipedia.org/wiki/%E0%B8%A3%E0%B8%B0%E0%B8%9A%E0%B8%9A%E0%B8%8A%E0%B8%99%E0%B8%B4%E0%B8%94%E0%B8%82%E0%B9%89%E0%B8%AD%E0%B8%A1%E0%B8%B9%E0%B8%A5" title="ระบบชนิดข้อมูล – Thai" lang="th" hreflang="th" data-title="ระบบชนิดข้อมูล" data-language-autonym="ไทย" data-language-local-name="Thai" class="interlanguage-link-target"><span>ไทย</span></a></li><li class="interlanguage-link interwiki-uk mw-list-item"><a href="https://uk.wikipedia.org/wiki/%D0%A1%D0%B8%D1%81%D1%82%D0%B5%D0%BC%D0%B0_%D1%82%D0%B8%D0%BF%D1%96%D0%B7%D0%B0%D1%86%D1%96%D1%97" title="Система типізації – Ukrainian" lang="uk" hreflang="uk" data-title="Система типізації" data-language-autonym="Українська" data-language-local-name="Ukrainian" class="interlanguage-link-target"><span>Українська</span></a></li><li class="interlanguage-link interwiki-vi mw-list-item"><a href="https://vi.wikipedia.org/wiki/H%E1%BB%87_th%E1%BB%91ng_ki%E1%BB%83u" title="Hệ thống kiểu – Vietnamese" lang="vi" hreflang="vi" data-title="Hệ thống kiểu" data-language-autonym="Tiếng Việt" data-language-local-name="Vietnamese" class="interlanguage-link-target"><span>Tiếng Việt</span></a></li><li class="interlanguage-link interwiki-zh-yue mw-list-item"><a href="https://zh-yue.wikipedia.org/wiki/%E9%A1%9E%E5%9E%8B%E7%B3%BB%E7%B5%B1" title="類型系統 – Cantonese" lang="yue" hreflang="yue" data-title="類型系統" data-language-autonym="粵語" data-language-local-name="Cantonese" class="interlanguage-link-target"><span>粵語</span></a></li><li class="interlanguage-link interwiki-zh mw-list-item"><a href="https://zh.wikipedia.org/wiki/%E9%A1%9E%E5%9E%8B%E7%B3%BB%E7%B5%B1" title="類型系統 – Chinese" lang="zh" hreflang="zh" data-title="類型系統" data-language-autonym="中文" data-language-local-name="Chinese" class="interlanguage-link-target"><span>中文</span></a></li> </ul> <div class="after-portlet after-portlet-lang"><span class="wb-langlinks-edit wb-langlinks-link"><a href="https://www.wikidata.org/wiki/Special:EntityPage/Q865760#sitelinks-wikipedia" title="Edit interlanguage links" class="wbc-editpage">Edit links</a></span></div> </div> </div> </div> </header> <div class="vector-page-toolbar"> <div class="vector-page-toolbar-container"> <div id="left-navigation"> <nav aria-label="Namespaces"> <div id="p-associated-pages" class="vector-menu vector-menu-tabs mw-portlet mw-portlet-associated-pages" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-nstab-main" class="selected vector-tab-noicon mw-list-item"><a href="/wiki/Type_system" title="View the content page [c]" accesskey="c"><span>Article</span></a></li><li id="ca-talk" class="vector-tab-noicon mw-list-item"><a href="/wiki/Talk:Type_system" rel="discussion" title="Discuss improvements to the content page [t]" accesskey="t"><span>Talk</span></a></li> </ul> </div> </div> <div id="vector-variants-dropdown" class="vector-dropdown emptyPortlet" > <input type="checkbox" id="vector-variants-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-variants-dropdown" class="vector-dropdown-checkbox " aria-label="Change language variant" > <label id="vector-variants-dropdown-label" for="vector-variants-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet" aria-hidden="true" ><span class="vector-dropdown-label-text">English</span> </label> <div class="vector-dropdown-content"> <div id="p-variants" class="vector-menu mw-portlet mw-portlet-variants emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> </div> </div> </nav> </div> <div id="right-navigation" class="vector-collapsible"> <nav aria-label="Views"> <div id="p-views" class="vector-menu vector-menu-tabs mw-portlet mw-portlet-views" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-view" class="selected vector-tab-noicon mw-list-item"><a href="/wiki/Type_system"><span>Read</span></a></li><li id="ca-edit" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Type_system&action=edit" title="Edit this page [e]" accesskey="e"><span>Edit</span></a></li><li id="ca-history" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Type_system&action=history" title="Past revisions of this page [h]" accesskey="h"><span>View history</span></a></li> </ul> </div> </div> </nav> <nav class="vector-page-tools-landmark" aria-label="Page tools"> <div id="vector-page-tools-dropdown" class="vector-dropdown vector-page-tools-dropdown" > <input type="checkbox" id="vector-page-tools-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-page-tools-dropdown" class="vector-dropdown-checkbox " aria-label="Tools" > <label id="vector-page-tools-dropdown-label" for="vector-page-tools-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet" aria-hidden="true" ><span class="vector-dropdown-label-text">Tools</span> </label> <div class="vector-dropdown-content"> <div id="vector-page-tools-unpinned-container" class="vector-unpinned-container"> <div id="vector-page-tools" class="vector-page-tools vector-pinnable-element"> <div class="vector-pinnable-header vector-page-tools-pinnable-header vector-pinnable-header-unpinned" data-feature-name="page-tools-pinned" data-pinnable-element-id="vector-page-tools" data-pinned-container-id="vector-page-tools-pinned-container" data-unpinned-container-id="vector-page-tools-unpinned-container" > <div class="vector-pinnable-header-label">Tools</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-page-tools.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-page-tools.unpin">hide</button> </div> <div id="p-cactions" class="vector-menu mw-portlet mw-portlet-cactions emptyPortlet vector-has-collapsible-items" title="More options" > <div class="vector-menu-heading"> Actions </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-more-view" class="selected vector-more-collapsible-item mw-list-item"><a href="/wiki/Type_system"><span>Read</span></a></li><li id="ca-more-edit" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Type_system&action=edit" title="Edit this page [e]" accesskey="e"><span>Edit</span></a></li><li id="ca-more-history" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Type_system&action=history"><span>View history</span></a></li> </ul> </div> </div> <div id="p-tb" class="vector-menu mw-portlet mw-portlet-tb" > <div class="vector-menu-heading"> General </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="t-whatlinkshere" class="mw-list-item"><a href="/wiki/Special:WhatLinksHere/Type_system" title="List of all English Wikipedia pages containing links to this page [j]" accesskey="j"><span>What links here</span></a></li><li id="t-recentchangeslinked" class="mw-list-item"><a href="/wiki/Special:RecentChangesLinked/Type_system" rel="nofollow" title="Recent changes in pages linked from this page [k]" accesskey="k"><span>Related changes</span></a></li><li id="t-upload" class="mw-list-item"><a href="//en.wikipedia.org/wiki/Wikipedia:File_Upload_Wizard" title="Upload files [u]" accesskey="u"><span>Upload file</span></a></li><li id="t-permalink" class="mw-list-item"><a href="/w/index.php?title=Type_system&oldid=1274970460" title="Permanent link to this revision of this page"><span>Permanent link</span></a></li><li id="t-info" class="mw-list-item"><a href="/w/index.php?title=Type_system&action=info" title="More information about this page"><span>Page information</span></a></li><li id="t-cite" class="mw-list-item"><a href="/w/index.php?title=Special:CiteThisPage&page=Type_system&id=1274970460&wpFormIdentifier=titleform" title="Information on how to cite this page"><span>Cite this page</span></a></li><li id="t-urlshortener" class="mw-list-item"><a href="/w/index.php?title=Special:UrlShortener&url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FType_system%23Dynamic_type_checking_and_runtime_type_information"><span>Get shortened URL</span></a></li><li id="t-urlshortener-qrcode" class="mw-list-item"><a href="/w/index.php?title=Special:QrCode&url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FType_system%23Dynamic_type_checking_and_runtime_type_information"><span>Download QR code</span></a></li> </ul> </div> </div> <div id="p-coll-print_export" class="vector-menu mw-portlet mw-portlet-coll-print_export" > <div class="vector-menu-heading"> Print/export </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="coll-download-as-rl" class="mw-list-item"><a href="/w/index.php?title=Special:DownloadAsPdf&page=Type_system&action=show-download-screen" title="Download this page as a PDF file"><span>Download as PDF</span></a></li><li id="t-print" class="mw-list-item"><a href="/w/index.php?title=Type_system&printable=yes" title="Printable version of this page [p]" accesskey="p"><span>Printable version</span></a></li> </ul> </div> </div> <div id="p-wikibase-otherprojects" class="vector-menu mw-portlet mw-portlet-wikibase-otherprojects" > <div class="vector-menu-heading"> In other projects </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li class="wb-otherproject-link wb-otherproject-commons mw-list-item"><a href="https://commons.wikimedia.org/wiki/Category:Type_systems" hreflang="en"><span>Wikimedia Commons</span></a></li><li id="t-wikibase" class="wb-otherproject-link wb-otherproject-wikibase-dataitem mw-list-item"><a href="https://www.wikidata.org/wiki/Special:EntityPage/Q865760" title="Structured data on this page hosted by Wikidata [g]" accesskey="g"><span>Wikidata item</span></a></li> </ul> </div> </div> </div> </div> </div> </div> </nav> </div> </div> </div> <div class="vector-column-end"> <div class="vector-sticky-pinned-container"> <nav class="vector-page-tools-landmark" aria-label="Page tools"> <div id="vector-page-tools-pinned-container" class="vector-pinned-container"> </div> </nav> <nav class="vector-appearance-landmark" aria-label="Appearance"> <div id="vector-appearance-pinned-container" class="vector-pinned-container"> <div id="vector-appearance" class="vector-appearance vector-pinnable-element"> <div class="vector-pinnable-header vector-appearance-pinnable-header vector-pinnable-header-pinned" data-feature-name="appearance-pinned" data-pinnable-element-id="vector-appearance" data-pinned-container-id="vector-appearance-pinned-container" data-unpinned-container-id="vector-appearance-unpinned-container" > <div class="vector-pinnable-header-label">Appearance</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-appearance.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-appearance.unpin">hide</button> </div> </div> </div> </nav> </div> </div> <div id="bodyContent" class="vector-body" aria-labelledby="firstHeading" data-mw-ve-target-container> <div class="vector-body-before-content"> <div class="mw-indicators"> </div> <div id="siteSub" class="noprint">From Wikipedia, the free encyclopedia</div> </div> <div id="contentSub"><div id="mw-content-subtitle"><span class="mw-redirectedfrom">(Redirected from <a href="/w/index.php?title=Dynamically_typed&redirect=no" class="mw-redirect" title="Dynamically typed">Dynamically typed</a>)</span></div></div> <div id="mw-content-text" class="mw-body-content"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr"><div class="shortdescription nomobile noexcerpt noprint searchaux" style="display:none">Computer science concept</div> <style data-mw-deduplicate="TemplateStyles:r1236090951">.mw-parser-output .hatnote{font-style:italic}.mw-parser-output div.hatnote{padding-left:1.6em;margin-bottom:0.5em}.mw-parser-output .hatnote i{font-style:normal}.mw-parser-output .hatnote+link+.hatnote{margin-top:-0.5em}@media print{body.ns-0 .mw-parser-output .hatnote{display:none!important}}</style><div role="note" class="hatnote navigation-not-searchable">This article is about type systems in computer programming. For the formal study of type systems, see <a href="/wiki/Type_theory" title="Type theory">Type theory</a>.</div> <style data-mw-deduplicate="TemplateStyles:r1251242444">.mw-parser-output .ambox{border:1px solid #a2a9b1;border-left:10px solid #36c;background-color:#fbfbfb;box-sizing:border-box}.mw-parser-output .ambox+link+.ambox,.mw-parser-output .ambox+link+style+.ambox,.mw-parser-output .ambox+link+link+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+style+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+link+.ambox{margin-top:-1px}html body.mediawiki .mw-parser-output .ambox.mbox-small-left{margin:4px 1em 4px 0;overflow:hidden;width:238px;border-collapse:collapse;font-size:88%;line-height:1.25em}.mw-parser-output .ambox-speedy{border-left:10px solid #b32424;background-color:#fee7e6}.mw-parser-output .ambox-delete{border-left:10px solid #b32424}.mw-parser-output .ambox-content{border-left:10px solid #f28500}.mw-parser-output .ambox-style{border-left:10px solid #fc3}.mw-parser-output .ambox-move{border-left:10px solid #9932cc}.mw-parser-output .ambox-protection{border-left:10px solid #a2a9b1}.mw-parser-output .ambox .mbox-text{border:none;padding:0.25em 0.5em;width:100%}.mw-parser-output .ambox .mbox-image{border:none;padding:2px 0 2px 0.5em;text-align:center}.mw-parser-output .ambox .mbox-imageright{border:none;padding:2px 0.5em 2px 0;text-align:center}.mw-parser-output .ambox .mbox-empty-cell{border:none;padding:0;width:1px}.mw-parser-output .ambox .mbox-image-div{width:52px}@media(min-width:720px){.mw-parser-output .ambox{margin:0 10%}}@media print{body.ns-0 .mw-parser-output .ambox{display:none!important}}</style><table class="box-More_footnotes_needed plainlinks metadata ambox ambox-style ambox-More_footnotes_needed" role="presentation"><tbody><tr><td class="mbox-image"><div class="mbox-image-div"><span typeof="mw:File"><span><img alt="" src="//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Text_document_with_red_question_mark.svg/40px-Text_document_with_red_question_mark.svg.png" decoding="async" width="40" height="40" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Text_document_with_red_question_mark.svg/60px-Text_document_with_red_question_mark.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Text_document_with_red_question_mark.svg/80px-Text_document_with_red_question_mark.svg.png 2x" data-file-width="48" data-file-height="48" /></span></span></div></td><td class="mbox-text"><div class="mbox-text-span">This article includes a list of <a href="/wiki/Wikipedia:Citing_sources#General_references" title="Wikipedia:Citing sources">general references</a>, but <b>it lacks sufficient corresponding <a href="/wiki/Wikipedia:Citing_sources#Inline_citations" title="Wikipedia:Citing sources">inline citations</a></b>.<span class="hide-when-compact"> Please help to <a href="/wiki/Wikipedia:WikiProject_Reliability" title="Wikipedia:WikiProject Reliability">improve</a> this article by <a href="/wiki/Wikipedia:When_to_cite" title="Wikipedia:When to cite">introducing</a> more precise citations.</span> <span class="date-container"><i>(<span class="date">October 2010</span>)</i></span><span class="hide-when-compact"><i> (<small><a href="/wiki/Help:Maintenance_template_removal" title="Help:Maintenance template removal">Learn how and when to remove this message</a></small>)</i></span></div></td></tr></tbody></table> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1251242444"><table class="box-Essay-like plainlinks metadata ambox ambox-style ambox-essay-like" role="presentation"><tbody><tr><td class="mbox-image"><div class="mbox-image-div"><span typeof="mw:File"><span><img alt="" src="//upload.wikimedia.org/wikipedia/en/thumb/f/f2/Edit-clear.svg/40px-Edit-clear.svg.png" decoding="async" width="40" height="40" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/en/thumb/f/f2/Edit-clear.svg/60px-Edit-clear.svg.png 1.5x, //upload.wikimedia.org/wikipedia/en/thumb/f/f2/Edit-clear.svg/80px-Edit-clear.svg.png 2x" data-file-width="48" data-file-height="48" /></span></span></div></td><td class="mbox-text"><div class="mbox-text-span">This article <b>is written like a <a href="/wiki/Wikipedia:What_Wikipedia_is_not#Wikipedia_is_not_a_publisher_of_original_thought" title="Wikipedia:What Wikipedia is not">personal reflection, personal essay, or argumentative essay</a></b> that states a Wikipedia editor's personal feelings or presents an original argument about a topic.<span class="hide-when-compact"> Please <a class="external text" href="https://en.wikipedia.org/w/index.php?title=Type_system&action=edit">help improve it</a> by rewriting it in an <a href="/wiki/Wikipedia:Writing_better_articles#Information_style_and_tone" title="Wikipedia:Writing better articles">encyclopedic style</a>.</span> <span class="date-container"><i>(<span class="date">July 2016</span>)</i></span><span class="hide-when-compact"><i> (<small><a href="/wiki/Help:Maintenance_template_removal" title="Help:Maintenance template removal">Learn how and when to remove this message</a></small>)</i></span></div></td></tr></tbody></table> <style data-mw-deduplicate="TemplateStyles:r1129693374">.mw-parser-output .hlist dl,.mw-parser-output .hlist ol,.mw-parser-output .hlist ul{margin:0;padding:0}.mw-parser-output .hlist dd,.mw-parser-output .hlist dt,.mw-parser-output .hlist li{margin:0;display:inline}.mw-parser-output .hlist.inline,.mw-parser-output .hlist.inline dl,.mw-parser-output .hlist.inline ol,.mw-parser-output .hlist.inline ul,.mw-parser-output .hlist dl dl,.mw-parser-output .hlist dl ol,.mw-parser-output .hlist dl ul,.mw-parser-output .hlist ol dl,.mw-parser-output .hlist ol ol,.mw-parser-output .hlist ol ul,.mw-parser-output .hlist ul dl,.mw-parser-output .hlist ul ol,.mw-parser-output .hlist ul ul{display:inline}.mw-parser-output .hlist .mw-empty-li{display:none}.mw-parser-output .hlist dt::after{content:": "}.mw-parser-output .hlist dd::after,.mw-parser-output .hlist li::after{content:" · ";font-weight:bold}.mw-parser-output .hlist dd:last-child::after,.mw-parser-output .hlist dt:last-child::after,.mw-parser-output .hlist li:last-child::after{content:none}.mw-parser-output .hlist dd dd:first-child::before,.mw-parser-output .hlist dd dt:first-child::before,.mw-parser-output .hlist dd li:first-child::before,.mw-parser-output .hlist dt dd:first-child::before,.mw-parser-output .hlist dt dt:first-child::before,.mw-parser-output .hlist dt li:first-child::before,.mw-parser-output .hlist li dd:first-child::before,.mw-parser-output .hlist li dt:first-child::before,.mw-parser-output .hlist li li:first-child::before{content:" (";font-weight:normal}.mw-parser-output .hlist dd dd:last-child::after,.mw-parser-output .hlist dd dt:last-child::after,.mw-parser-output .hlist dd li:last-child::after,.mw-parser-output .hlist dt dd:last-child::after,.mw-parser-output .hlist dt dt:last-child::after,.mw-parser-output .hlist dt li:last-child::after,.mw-parser-output .hlist li dd:last-child::after,.mw-parser-output .hlist li dt:last-child::after,.mw-parser-output .hlist li li:last-child::after{content:")";font-weight:normal}.mw-parser-output .hlist ol{counter-reset:listitem}.mw-parser-output .hlist ol>li{counter-increment:listitem}.mw-parser-output .hlist ol>li::before{content:" "counter(listitem)"\a0 "}.mw-parser-output .hlist dd ol>li:first-child::before,.mw-parser-output .hlist dt ol>li:first-child::before,.mw-parser-output .hlist li ol>li:first-child::before{content:" ("counter(listitem)"\a0 "}</style><style data-mw-deduplicate="TemplateStyles:r1246091330">.mw-parser-output .sidebar{width:22em;float:right;clear:right;margin:0.5em 0 1em 1em;background:var(--background-color-neutral-subtle,#f8f9fa);border:1px solid var(--border-color-base,#a2a9b1);padding:0.2em;text-align:center;line-height:1.4em;font-size:88%;border-collapse:collapse;display:table}body.skin-minerva .mw-parser-output .sidebar{display:table!important;float:right!important;margin:0.5em 0 1em 1em!important}.mw-parser-output .sidebar-subgroup{width:100%;margin:0;border-spacing:0}.mw-parser-output .sidebar-left{float:left;clear:left;margin:0.5em 1em 1em 0}.mw-parser-output .sidebar-none{float:none;clear:both;margin:0.5em 1em 1em 0}.mw-parser-output .sidebar-outer-title{padding:0 0.4em 0.2em;font-size:125%;line-height:1.2em;font-weight:bold}.mw-parser-output .sidebar-top-image{padding:0.4em}.mw-parser-output .sidebar-top-caption,.mw-parser-output .sidebar-pretitle-with-top-image,.mw-parser-output .sidebar-caption{padding:0.2em 0.4em 0;line-height:1.2em}.mw-parser-output .sidebar-pretitle{padding:0.4em 0.4em 0;line-height:1.2em}.mw-parser-output .sidebar-title,.mw-parser-output .sidebar-title-with-pretitle{padding:0.2em 0.8em;font-size:145%;line-height:1.2em}.mw-parser-output .sidebar-title-with-pretitle{padding:0.1em 0.4em}.mw-parser-output .sidebar-image{padding:0.2em 0.4em 0.4em}.mw-parser-output .sidebar-heading{padding:0.1em 0.4em}.mw-parser-output .sidebar-content{padding:0 0.5em 0.4em}.mw-parser-output .sidebar-content-with-subgroup{padding:0.1em 0.4em 0.2em}.mw-parser-output .sidebar-above,.mw-parser-output .sidebar-below{padding:0.3em 0.8em;font-weight:bold}.mw-parser-output .sidebar-collapse .sidebar-above,.mw-parser-output .sidebar-collapse .sidebar-below{border-top:1px solid #aaa;border-bottom:1px solid #aaa}.mw-parser-output .sidebar-navbar{text-align:right;font-size:115%;padding:0 0.4em 0.4em}.mw-parser-output .sidebar-list-title{padding:0 0.4em;text-align:left;font-weight:bold;line-height:1.6em;font-size:105%}.mw-parser-output .sidebar-list-title-c{padding:0 0.4em;text-align:center;margin:0 3.3em}@media(max-width:640px){body.mediawiki .mw-parser-output .sidebar{width:100%!important;clear:both;float:none!important;margin-left:0!important;margin-right:0!important}}body.skin--responsive .mw-parser-output .sidebar a>img{max-width:none!important}@media screen{html.skin-theme-clientpref-night .mw-parser-output .sidebar:not(.notheme) .sidebar-list-title,html.skin-theme-clientpref-night .mw-parser-output .sidebar:not(.notheme) .sidebar-title-with-pretitle{background:transparent!important}html.skin-theme-clientpref-night .mw-parser-output .sidebar:not(.notheme) .sidebar-title-with-pretitle a{color:var(--color-progressive)!important}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .sidebar:not(.notheme) .sidebar-list-title,html.skin-theme-clientpref-os .mw-parser-output .sidebar:not(.notheme) .sidebar-title-with-pretitle{background:transparent!important}html.skin-theme-clientpref-os .mw-parser-output .sidebar:not(.notheme) .sidebar-title-with-pretitle a{color:var(--color-progressive)!important}}@media print{body.ns-0 .mw-parser-output .sidebar{display:none!important}}</style><table class="sidebar nomobile nowraplinks" style="margin-top: 0.5em;"><tbody><tr><th class="sidebar-title" style="background-color: rgba(51, 153, 255, 0.15);"><a class="mw-selflink selflink">Type systems</a></th></tr><tr><th class="sidebar-heading" style="background-color: rgba(51, 153, 255, 0.15);"> General concepts</th></tr><tr><td class="sidebar-content" style="text-align: left;"> <ul><li><a href="/wiki/Type_safety" title="Type safety">Type safety</a></li> <li><a href="/wiki/Strong_and_weak_typing" title="Strong and weak typing">Strong vs. weak typing</a></li></ul></td> </tr><tr><th class="sidebar-heading" style="background-color: rgba(51, 153, 255, 0.15);"> Major categories</th></tr><tr><td class="sidebar-content" style="text-align: left;"> <ul><li><a class="mw-selflink-fragment" href="#Static_type_checking">Static</a> vs. <a class="mw-selflink-fragment" href="#Dynamic_type_checking_and_runtime_type_information">dynamic</a></li> <li><a href="/wiki/Manifest_typing" title="Manifest typing">Manifest</a> vs. <a href="/wiki/Type_inference" title="Type inference">inferred</a></li> <li><a href="/wiki/Nominal_type_system" title="Nominal type system">Nominal</a> vs. <a href="/wiki/Structural_type_system" title="Structural type system">structural</a></li> <li><a href="/wiki/Duck_typing" title="Duck typing">Duck typing</a></li></ul></td> </tr><tr><th class="sidebar-heading" style="background-color: rgba(51, 153, 255, 0.15);"> Minor categories</th></tr><tr><td class="sidebar-content" style="text-align: left;"> <ul><li><a href="/wiki/Abstract_type" title="Abstract type">Abstract</a></li> <li><a href="/wiki/Dependent_type" title="Dependent type">Dependent</a></li> <li><a href="/wiki/Flow-sensitive_typing" title="Flow-sensitive typing">Flow-sensitive</a></li> <li><a href="/wiki/Gradual_typing" title="Gradual typing">Gradual</a></li> <li><a href="/wiki/Intersection_type" title="Intersection type">Intersection</a></li> <li><a href="/wiki/Latent_typing" title="Latent typing">Latent</a></li> <li><a href="/wiki/Refinement_type" title="Refinement type">Refinement</a></li> <li><a href="/wiki/Substructural_type_system" title="Substructural type system">Substructural</a></li> <li><a href="/wiki/Uniqueness_type" title="Uniqueness type">Unique</a></li> <li><a href="/wiki/Session_type" title="Session type">Session</a></li></ul></td> </tr><tr><td class="sidebar-navbar"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1129693374"><style data-mw-deduplicate="TemplateStyles:r1239400231">.mw-parser-output .navbar{display:inline;font-size:88%;font-weight:normal}.mw-parser-output .navbar-collapse{float:left;text-align:left}.mw-parser-output .navbar-boxtext{word-spacing:0}.mw-parser-output .navbar ul{display:inline-block;white-space:nowrap;line-height:inherit}.mw-parser-output .navbar-brackets::before{margin-right:-0.125em;content:"[ "}.mw-parser-output .navbar-brackets::after{margin-left:-0.125em;content:" ]"}.mw-parser-output .navbar li{word-spacing:-0.125em}.mw-parser-output .navbar a>span,.mw-parser-output .navbar a>abbr{text-decoration:inherit}.mw-parser-output .navbar-mini abbr{font-variant:small-caps;border-bottom:none;text-decoration:none;cursor:inherit}.mw-parser-output .navbar-ct-full{font-size:114%;margin:0 7em}.mw-parser-output .navbar-ct-mini{font-size:114%;margin:0 4em}html.skin-theme-clientpref-night .mw-parser-output .navbar li a abbr{color:var(--color-base)!important}@media(prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .navbar li a abbr{color:var(--color-base)!important}}@media print{.mw-parser-output .navbar{display:none!important}}</style><div class="navbar plainlinks hlist navbar-mini"><ul><li class="nv-view"><a href="/wiki/Template:Type_systems" title="Template:Type systems"><abbr title="View this template">v</abbr></a></li><li class="nv-talk"><a href="/wiki/Template_talk:Type_systems" title="Template talk:Type systems"><abbr title="Discuss this template">t</abbr></a></li><li class="nv-edit"><a href="/wiki/Special:EditPage/Template:Type_systems" title="Special:EditPage/Template:Type systems"><abbr title="Edit this template">e</abbr></a></li></ul></div></td></tr></tbody></table> <p>In <a href="/wiki/Computer_programming" title="Computer programming">computer programming</a>, a <b>type system</b> is a <a href="/wiki/Logical_system" class="mw-redirect" title="Logical system">logical system</a> comprising a set of rules that assigns a property called a <a href="/wiki/Type_(computer_science)" class="mw-redirect" title="Type (computer science)"><i>type</i></a> (for example, <a href="/wiki/Integer" title="Integer">integer</a>, <a href="/wiki/Floating_point" class="mw-redirect" title="Floating point">floating point</a>, <a href="/wiki/String_(computer_science)" title="String (computer science)">string</a>) to every <i><a href="/wiki/Term_(programming)" class="mw-redirect" title="Term (programming)">term</a></i> (a word, phrase, or other set of symbols). Usually the terms are various <a href="/wiki/Language_construct" title="Language construct">language constructs</a> of a <a href="/wiki/Computer_program" title="Computer program">computer program</a>, such as <a href="/wiki/Variable_(computer_science)" title="Variable (computer science)">variables</a>, <a href="/wiki/Expression_(computer_science)" title="Expression (computer science)">expressions</a>, <a href="/wiki/Function_(computer_science)" class="mw-redirect" title="Function (computer science)">functions</a>, or <a href="/wiki/Modular_programming" title="Modular programming">modules</a>.<sup id="cite_ref-FOOTNOTEPierce20021_1-0" class="reference"><a href="#cite_note-FOOTNOTEPierce20021-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup> A type system dictates the operations that can be performed on a term. For variables, the type system determines the allowed values of that term. </p><p>Type systems formalize and enforce the otherwise implicit categories the programmer uses for <a href="/wiki/Algebraic_data_type" title="Algebraic data type">algebraic data types</a>, <a href="/wiki/Data_structure" title="Data structure">data structures</a>, or other <a href="/wiki/Data_type" title="Data type">data types</a>, such as "string", "array of float", "function returning boolean". </p><p>Type systems are often specified as part of <a href="/wiki/Programming_language" title="Programming language">programming languages</a> and built into <a href="/wiki/Interpreter_(computing)" title="Interpreter (computing)">interpreters</a> and <a href="/wiki/Compiler" title="Compiler">compilers</a>, although the type system of a language can be extended by <a href="/wiki/Extended_static_checking" title="Extended static checking">optional tools</a> that perform added checks using the language's original type <a href="/wiki/Syntax_(programming_languages)" title="Syntax (programming languages)">syntax</a> and <a href="/wiki/Formal_grammar" title="Formal grammar">grammar</a>. </p><p>The main purpose of a type system in a programming language is to reduce possibilities for <a href="/wiki/Bug_(computer_programming)" class="mw-redirect" title="Bug (computer programming)">bugs</a> in computer programs due to <a href="/wiki/Type_error" class="mw-redirect" title="Type error">type errors</a>.<sup id="cite_ref-FOOTNOTECardelli20041_2-0" class="reference"><a href="#cite_note-FOOTNOTECardelli20041-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup> The given type system in question determines what constitutes a type error, but in general, the aim is to prevent operations expecting a certain kind of value from being used with values of which that operation does not make sense (validity errors). </p><p>Type systems allow defining <a href="/wiki/Interface_(computer_science)" class="mw-redirect" title="Interface (computer science)">interfaces</a> between different parts of a computer program, and then checking that the parts have been connected in a consistent way. This checking can happen statically (at <a href="/wiki/Compile_time" title="Compile time">compile time</a>), dynamically (at <a href="/wiki/Run_time_(program_lifecycle_phase)" class="mw-redirect" title="Run time (program lifecycle phase)">run time</a>), or as a combination of both. </p><p>Type systems have other purposes as well, such as expressing business rules, enabling certain <a href="/wiki/Compiler_optimization" class="mw-redirect" title="Compiler optimization">compiler optimizations</a>, allowing for <a href="/wiki/Multiple_dispatch" title="Multiple dispatch">multiple dispatch</a>, and providing a form of <a href="/wiki/Software_documentation" title="Software documentation">documentation</a>. </p> <meta property="mw:PageProp/toc" /> <div class="mw-heading mw-heading2"><h2 id="Usage_overview">Usage overview</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_system&action=edit&section=1" title="Edit section: Usage overview"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>An example of a simple type system is that of the <a href="/wiki/C_(programming_language)" title="C (programming language)">C language</a>. The portions of a C program are the <a href="/wiki/Subroutine" class="mw-redirect" title="Subroutine">function</a> definitions. One function is invoked by another function. </p><p>The <a href="/wiki/Interface_(computing)" title="Interface (computing)">interface</a> of a function states the name of the function and a list of <a href="/wiki/Parameter_(computer_programming)" title="Parameter (computer programming)">parameters</a> that are passed to the function's code. The code of an invoking function states the name of the invoked, along with the names of <a href="/wiki/Variable_(computer_science)" title="Variable (computer science)">variables</a> that hold values to pass to it. </p><p>During a <a href="/wiki/Computer_program" title="Computer program">computer program</a>'s execution, the values are placed into temporary storage, then execution jumps to the code of the invoked function. The invoked function's code accesses the values and makes use of them. </p><p>If the instructions inside the function are written with the assumption of receiving an <a href="/wiki/Integer_(computer_science)" title="Integer (computer science)">integer</a> value, but the calling code passed a <a href="/wiki/Floating-point_arithmetic" title="Floating-point arithmetic">floating-point value</a>, then the wrong result will be computed by the invoked function. </p><p>The C compiler checks the types of the arguments passed to a function when it is called against the types of the parameters declared in the function's definition. If the types do not match, the compiler throws a compile-time error or warning. </p><p>A <a href="/wiki/Compiler" title="Compiler">compiler</a> may also use the static type of a value to optimize the storage it needs and the choice of <a href="/wiki/Algorithm" title="Algorithm">algorithms</a> for operations on the value. In many <a href="/wiki/C_(programming_language)" title="C (programming language)">C</a> compilers the <i>float</i> <a href="/wiki/Data_type" title="Data type">data type</a>, for example, is represented in 32 <a href="/wiki/Bit" title="Bit">bits</a>, in accord with the <a href="/wiki/IEEE_754-2008_revision" title="IEEE 754-2008 revision">IEEE specification for single-precision floating point numbers</a>. They will thus use floating-point-specific <a href="/wiki/Instruction_set" class="mw-redirect" title="Instruction set">microprocessor operations</a> on those values (floating-point addition, multiplication, etc.). </p><p>The depth of type constraints and the manner of their evaluation affect the <i>typing</i> of the language. A <a href="/wiki/Programming_language" title="Programming language">programming language</a> may further associate an operation with various resolutions for each type, in the case of type <a href="/wiki/Polymorphism_(computer_science)" title="Polymorphism (computer science)">polymorphism</a>. <a href="/wiki/Type_theory" title="Type theory">Type theory</a> is the study of type systems. The concrete types of some programming languages, such as integers and strings, depend on practical issues of <a href="/wiki/Computer_architecture" title="Computer architecture">computer architecture</a>, compiler implementation, and <a href="/wiki/Programming_language_design_and_implementation" title="Programming language design and implementation">language design</a>. </p> <div class="mw-heading mw-heading2"><h2 id="Fundamentals">Fundamentals</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_system&action=edit&section=2" title="Edit section: Fundamentals"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Formally, <a href="/wiki/Type_theory" title="Type theory">type theory</a> studies type systems. A programming language must have the opportunity to type check using the <i>type system</i> whether at compile time or runtime, manually annotated or automatically inferred. As Mark Manasse concisely put it:<sup id="cite_ref-FOOTNOTEPierce2002208_3-0" class="reference"><a href="#cite_note-FOOTNOTEPierce2002208-3"><span class="cite-bracket">[</span>3<span class="cite-bracket">]</span></a></sup> </p> <style data-mw-deduplicate="TemplateStyles:r1244412712">.mw-parser-output .templatequote{overflow:hidden;margin:1em 0;padding:0 32px}.mw-parser-output .templatequotecite{line-height:1.5em;text-align:left;margin-top:0}@media(min-width:500px){.mw-parser-output .templatequotecite{padding-left:1.6em}}</style><blockquote class="templatequote"><p>The fundamental problem addressed by a type theory is to ensure that programs have meaning. The fundamental problem caused by a type theory is that meaningful programs may not have meanings ascribed to them. The quest for richer type systems results from this tension.</p></blockquote> <p>Assigning a data type, termed <i>typing</i>, gives meaning to a sequence of <a href="/wiki/Bit" title="Bit">bits</a> such as a value in <a href="/wiki/Computer_memory" title="Computer memory">memory</a> or some <a href="/wiki/Object_(computer_science)" title="Object (computer science)">object</a> such as a <a href="/wiki/Variable_(computer_science)" title="Variable (computer science)">variable</a>. The <a href="/wiki/Computer_hardware" title="Computer hardware">hardware</a> of a <a href="/wiki/General_purpose_computer" class="mw-redirect" title="General purpose computer">general purpose computer</a> is unable to discriminate between for example a <a href="/wiki/Memory_address" title="Memory address">memory address</a> and an <a href="/wiki/Instruction_code_(programming)" class="mw-redirect" title="Instruction code (programming)">instruction code</a>, or between a <a href="/wiki/Character_(computing)" title="Character (computing)">character</a>, an <a href="/wiki/Integer" title="Integer">integer</a>, or a <a href="/wiki/Floating-point_number" class="mw-redirect" title="Floating-point number">floating-point number</a>, because it makes no intrinsic distinction between any of the possible values that a sequence of bits might <i>mean</i>.<sup id="cite_ref-Burroughs_4-0" class="reference"><a href="#cite_note-Burroughs-4"><span class="cite-bracket">[</span>note 1<span class="cite-bracket">]</span></a></sup> Associating a sequence of bits with a type conveys that <a href="https://en.wiktionary.org/wiki/meaning" class="extiw" title="wikt:meaning">meaning</a> to the programmable hardware to form a <i><a href="/wiki/Symbolic_system" class="mw-redirect" title="Symbolic system">symbolic system</a></i> composed of that hardware and some program. </p><p>A program associates each value with at least one specific type, but it also can occur that one value is associated with many <a href="/wiki/Subtyping" title="Subtyping">subtypes</a>. Other entities, such as <a href="/wiki/Object_(computer_science)" title="Object (computer science)">objects</a>, <a href="/wiki/Module_(programming)" class="mw-redirect" title="Module (programming)">modules</a>, <a href="/wiki/Communication_channel" title="Communication channel">communication channels</a>, and <a href="/wiki/Dependency_(computer_science)" class="mw-redirect" title="Dependency (computer science)">dependencies</a> can become associated with a type. Even a type can become associated with a type. An implementation of a <i>type system</i> could in theory associate identifications called <i><a href="/wiki/Data_type" title="Data type">data type</a></i> (a type of a value), <i><a href="/wiki/Class_(computer_science)" class="mw-redirect" title="Class (computer science)">class</a></i> (a type of an object), and <i><a href="/wiki/Kind_(type_theory)" title="Kind (type theory)">kind</a></i> (a <i>type of a type</i>, or metatype). These are the abstractions that typing can go through, on a hierarchy of levels contained in a system. </p><p>When a programming language evolves a more elaborate type system, it gains a more finely grained rule set than basic type checking, but this comes at a price when the type <a href="/wiki/Inference" title="Inference">inferences</a> (and other properties) become <a href="/wiki/Undecidable_problem" title="Undecidable problem">undecidable</a>, and when more attention must be paid by the programmer to annotate code or to consider computer-related operations and functioning. It is challenging to find a sufficiently expressive type system that satisfies all programming practices in a <a href="/wiki/Type_safe" class="mw-redirect" title="Type safe">type safe</a> manner. </p><p>A programming language compiler can also implement a <i><a href="/wiki/Dependent_type" title="Dependent type">dependent type</a></i> or an <i><a href="/wiki/Effect_system" title="Effect system">effect system</a></i>, which enables even more program specifications to be verified by a type checker. Beyond simple value-type pairs, a virtual "region" of code is associated with an "effect" component describing <i>what</i> is being done <i>with what</i>, and enabling for example to "throw" an error report. Thus the symbolic system may be a <i>type and effect system</i>, which endows it with more safety checking than type checking alone. </p><p>Whether automated by the compiler or specified by a programmer, a type system renders program behavior illegal if it falls outside the type-system rules. Advantages provided by programmer-specified type systems include: </p> <ul><li><i>Abstraction</i> (or <i>modularity</i>) – Types enable programmers to think at a higher level than the bit or byte, not bothering with <a href="/wiki/Low-level_programming_language" title="Low-level programming language">low-level</a> implementation. For example, programmers can begin to think of a string as a set of character values instead of as an <a href="/wiki/Array_(data_structure)" title="Array (data structure)">array</a> of bytes. Higher still, types enable programmers to think about and express <a href="/wiki/Interface_(computer_science)" class="mw-redirect" title="Interface (computer science)">interfaces</a> between two of <i>any</i>-sized subsystems. This enables more levels of localization so that the definitions required for <a href="/wiki/Interoperability" title="Interoperability">interoperability</a> of the subsystems remain consistent when those two subsystems communicate.</li> <li><i>Documentation</i> – In more expressive type systems, types can serve as a form of <a href="/wiki/Documentation" title="Documentation">documentation</a> clarifying the intent of the programmer. For example, if a programmer declares a function as returning a timestamp type, this documents the function when the timestamp type can be explicitly declared deeper in the code to be an integer type.</li></ul> <p>Advantages provided by compiler-specified type systems include: </p> <ul><li><i>Optimization</i> – Static type-checking may provide useful <a href="/wiki/Compile_time" title="Compile time">compile-time</a> information. For example, if a type requires that a value must align in memory at a multiple of four bytes, the compiler may be able to use more efficient machine instructions.</li> <li><i>Safety</i> – A type system enables the <a href="/wiki/Compiler" title="Compiler">compiler</a> to detect meaningless or invalid code. For example, we can identify an expression <code>3 / "Hello, World"</code> as invalid, when the rules do not specify how to divide an <a href="/wiki/Integer" title="Integer">integer</a> by a <a href="/wiki/String_(computer_science)" title="String (computer science)">string</a>. Strong typing offers more safety, but cannot guarantee complete <i><a href="/wiki/Type_safety" title="Type safety">type safety</a></i>.</li></ul> <div class="mw-heading mw-heading3"><h3 id="Type_errors">Type errors</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_system&action=edit&section=3" title="Edit section: Type errors"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>A type error occurs when an operation receives a different type of data than it expected.<sup id="cite_ref-Sethi1997_5-0" class="reference"><a href="#cite_note-Sethi1997-5"><span class="cite-bracket">[</span>4<span class="cite-bracket">]</span></a></sup> For example, a type error would happen if a line of code divides two integers, and is passed a string of letters instead of an integer.<sup id="cite_ref-Sethi1997_5-1" class="reference"><a href="#cite_note-Sethi1997-5"><span class="cite-bracket">[</span>4<span class="cite-bracket">]</span></a></sup> It is an unintended condition<sup id="cite_ref-leakyCondition_8-0" class="reference"><a href="#cite_note-leakyCondition-8"><span class="cite-bracket">[</span>note 2<span class="cite-bracket">]</span></a></sup> which might manifest in multiple stages of a program's development. Thus a facility for detection of the error is needed in the type system. In some languages, such as <a href="/wiki/Haskell" title="Haskell">Haskell</a>, for which <a href="/wiki/Type_inference" title="Type inference">type inference</a> is automated, <a href="/wiki/Lint_(software)" title="Lint (software)">lint</a> might be available to its compiler to aid in the detection of error. </p><p>Type safety contributes to <a href="/wiki/Program_correctness" class="mw-redirect" title="Program correctness">program correctness</a>, but might only guarantee correctness at the cost of making the type checking itself an <a href="/wiki/Undecidable_problem" title="Undecidable problem">undecidable problem</a> (as in the <a href="/wiki/Halting_problem" title="Halting problem">Halting problem</a>). In a <i>type system</i> with automated type checking, a program may prove to run incorrectly yet produce no compiler errors. <a href="/wiki/Division_by_zero" title="Division by zero">Division by zero</a> is an unsafe and incorrect operation, but a type checker which only runs at <a href="/wiki/Compile_time" title="Compile time">compile time</a> does not scan for division by zero in most languages; that division would surface as a <a href="/wiki/Runtime_error" class="mw-redirect" title="Runtime error">runtime error</a>. To prove the absence of these defects, other kinds of <a href="/wiki/Formal_method" class="mw-redirect" title="Formal method">formal methods</a>, collectively known as <a href="/wiki/Program_analysis_(computer_science)" class="mw-redirect" title="Program analysis (computer science)">program analyses</a>, are in common use. Alternatively, a sufficiently expressive type system, such as in dependently typed languages, can prevent these kinds of errors (for example, expressing <i>the type of non-zero numbers</i>). In addition, <a href="/wiki/Software_testing" title="Software testing">software testing</a> is an <a href="/wiki/Empirical" class="mw-redirect" title="Empirical">empirical</a> method for finding errors that such a type checker would not detect. </p> <div class="mw-heading mw-heading2"><h2 id="Type_checking">Type checking</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_system&action=edit&section=4" title="Edit section: Type checking"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The process of verifying and enforcing the constraints of types—<i>type checking</i>—may occur at <a href="/wiki/Compile_time" title="Compile time">compile time</a> (a static check) or at <a href="/wiki/Runtime_(program_lifecycle_phase)" class="mw-redirect" title="Runtime (program lifecycle phase)">run-time</a> (a dynamic check). </p><p>If a language specification requires its typing rules strongly, more or less allowing only those automatic <a href="/wiki/Type_conversion" title="Type conversion">type conversions</a> that do not lose information, one can refer to the process as <i>strongly typed; i</i>f not, as <i>weakly typed</i>. </p><p>The terms are not usually used in a strict sense. </p> <div class="mw-heading mw-heading3"><h3 id="Static_type_checking">Static type checking<span class="anchor" id="STATIC"></span><span class="anchor" id="Static_typing"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_system&action=edit&section=5" title="Edit section: Static type checking"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1236090951"><div role="note" class="hatnote navigation-not-searchable">See also: <a href="/wiki/Category:Statically_typed_programming_languages" title="Category:Statically typed programming languages">Category:Statically typed programming languages</a></div> <p>Static type checking is the process of verifying the <a href="/wiki/Type_safety" title="Type safety">type safety</a> of a program based on analysis of a program's text (<a href="/wiki/Source_code" title="Source code">source code</a>). If a program passes a static type checker, then the program is guaranteed to satisfy some set of type safety properties for all possible inputs. </p><p>Static type checking can be considered a limited form of <a href="/wiki/Program_verification" class="mw-redirect" title="Program verification">program verification</a> (see <a href="/wiki/Type_safety" title="Type safety">type safety</a>), and in a type-safe language, can also be considered an optimization. If a compiler can prove that a program is well-typed, then it does not need to emit dynamic safety checks, allowing the resulting compiled binary to run faster and to be smaller. </p><p>Static type checking for <a href="/wiki/Turing_completeness" title="Turing completeness">Turing-complete</a> languages is inherently conservative. That is, if a type system is both <i>sound</i> (meaning that it rejects all incorrect programs) and <i>decidable</i> (meaning that it is possible to write an algorithm that determines whether a program is well-typed), then it must be <i>incomplete</i> (meaning there are correct programs, which are also rejected, even though they do not encounter runtime errors).<sup id="cite_ref-9" class="reference"><a href="#cite_note-9"><span class="cite-bracket">[</span>7<span class="cite-bracket">]</span></a></sup> For example, consider a program containing the code: </p> <dl><dd><code>if <complex test> then <do something> else <signal that there is a type error></code></dd></dl> <p>Even if the expression <code><complex test></code> always evaluates to <code>true</code> at run-time, most type checkers will reject the program as ill-typed, because it is difficult (if not impossible) for a static analyzer to determine that the <code>else</code> branch will not be taken.<sup id="cite_ref-FOOTNOTEPierce2002_10-0" class="reference"><a href="#cite_note-FOOTNOTEPierce2002-10"><span class="cite-bracket">[</span>8<span class="cite-bracket">]</span></a></sup> Consequently, a static type checker will quickly detect type errors in rarely used code paths. Without static type checking, even <a href="/wiki/Code_coverage" title="Code coverage">code coverage</a> tests with 100% coverage may be unable to find such type errors. The tests may fail to detect such type errors, because the combination of all places where values are created and all places where a certain value is used must be taken into account. </p><p>A number of useful and common programming language features cannot be checked statically, such as <a href="/wiki/Downcasting" title="Downcasting">downcasting</a>. Thus, many languages will have both static and dynamic type checking; the static type checker verifies what it can, and dynamic checks verify the rest. </p><p>Many languages with static type checking provide a way to bypass the type checker. Some languages allow programmers to choose between static and dynamic type safety. For example, historically C# declares variables statically,<sup id="cite_ref-Skeet_11-0" class="reference"><a href="#cite_note-Skeet-11"><span class="cite-bracket">[</span>9<span class="cite-bracket">]</span></a></sup><sup class="reference nowrap"><span title="Location: 77, Section 3.2">: 77, Section 3.2 </span></sup> but <a href="/wiki/C_Sharp_4.0" title="C Sharp 4.0">C# 4.0</a> introduces the <code>dynamic</code> keyword, which is used to declare variables to be checked dynamically at runtime.<sup id="cite_ref-Skeet_11-1" class="reference"><a href="#cite_note-Skeet-11"><span class="cite-bracket">[</span>9<span class="cite-bracket">]</span></a></sup><sup class="reference nowrap"><span title="Location: 117, Section 4.1">: 117, Section 4.1 </span></sup> Other languages allow writing code that is not type-safe; for example, in <a href="/wiki/C_(programming_language)" title="C (programming language)">C</a>, programmers can freely cast a value between any two types that have the same size, effectively subverting the type concept. </p> <div class="mw-heading mw-heading3"><h3 id="Dynamic_type_checking_and_runtime_type_information">Dynamic type checking and runtime type information<span class="anchor" id="DYNAMIC"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_system&action=edit&section=6" title="Edit section: Dynamic type checking and runtime type information"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1236090951"><div role="note" class="hatnote navigation-not-searchable">See also: <a href="/wiki/Dynamic_programming_language" title="Dynamic programming language">Dynamic programming language</a>, <a href="/wiki/Interpreted_language" class="mw-redirect" title="Interpreted language">Interpreted language</a>, and <a href="/wiki/Category:Dynamically_typed_programming_languages" title="Category:Dynamically typed programming languages">Category:Dynamically typed programming languages</a></div> <p>Dynamic type checking is the process of verifying the type safety of a program at runtime. Implementations of dynamically type-checked languages generally associate each runtime object with a <i>type tag</i> (i.e., a reference to a type) containing its type information. This runtime type information (RTTI) can also be used to implement <a href="/wiki/Dynamic_dispatch" title="Dynamic dispatch">dynamic dispatch</a>, <a href="/wiki/Late_binding" title="Late binding">late binding</a>, <a href="/wiki/Downcasting" title="Downcasting">downcasting</a>, <a href="/wiki/Reflective_programming" title="Reflective programming">reflective programming</a> (reflection), and similar features. </p><p>Most type-safe languages include some form of dynamic type checking, even if they also have a static type checker.<sup id="cite_ref-12" class="reference"><a href="#cite_note-12"><span class="cite-bracket">[</span>10<span class="cite-bracket">]</span></a></sup> The reason for this is that many useful features or properties are difficult or impossible to verify statically. For example, suppose that a program defines two types, A and B, where B is a subtype of A. If the program tries to convert a value of type A to type B, which is known as <a href="/wiki/Downcasting" title="Downcasting">downcasting</a>, then the operation is legal only if the value being converted is actually a value of type B. Thus, a dynamic check is needed to verify that the operation is safe. This requirement is one of the criticisms of downcasting. </p><p>By definition, dynamic type checking may cause a program to fail at runtime. In some programming languages, it is possible to anticipate and recover from these failures. In others, type-checking errors are considered fatal. </p><p>Programming languages that include dynamic type checking but not static type checking are often called "dynamically typed programming languages". </p> <div class="mw-heading mw-heading3"><h3 id="Combining_static_and_dynamic_type_checking">Combining static and dynamic type checking<span class="anchor" id="COMBINED"></span></h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_system&action=edit&section=7" title="Edit section: Combining static and dynamic type checking"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Some languages allow both static and dynamic typing. For example, Java and some other ostensibly statically typed languages support <a href="/wiki/Downcasting" title="Downcasting">downcasting</a> types to their <a href="/wiki/Subtypes" class="mw-redirect" title="Subtypes">subtypes</a>, querying an object to discover its dynamic type and other type operations that depend on runtime type information. Another example is <a href="/wiki/Run-time_type_information" title="Run-time type information">C++ RTTI</a>. More generally, most programming languages include mechanisms for dispatching over different 'kinds' of data, such as <a href="/wiki/Disjoint_union" title="Disjoint union">disjoint unions</a>, <a href="/wiki/Dynamic_dispatch" title="Dynamic dispatch">runtime polymorphism</a>, and <a href="/wiki/Variant_type" class="mw-redirect" title="Variant type">variant types</a>. Even when not interacting with type annotations or type checking, such mechanisms are materially similar to dynamic typing implementations. <style data-mw-deduplicate="TemplateStyles:r1033199720">.mw-parser-output div.crossreference{padding-left:0}</style><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1236090951"><span role="note" class="hatnote navigation-not-searchable crossreference">See <a href="/wiki/Programming_language" title="Programming language">programming language</a> for more discussion of the interactions between static and dynamic typing.</span> </p><p>Objects in object-oriented languages are usually accessed by a reference whose static target type (or manifest type) is equal to either the object's run-time type (its latent type) or a supertype thereof. This is conformant with the <a href="/wiki/Liskov_substitution_principle" title="Liskov substitution principle">Liskov substitution principle</a>, which states that all operations performed on an instance of a given type can also be performed on an instance of a subtype. This concept is also known as subsumption or <a href="/wiki/Subtyping" title="Subtyping">subtype polymorphism</a>. In some languages subtypes may also possess <a href="/wiki/Covariance_and_contravariance_(computer_science)" title="Covariance and contravariance (computer science)">covariant or contravariant</a> return types and argument types respectively. </p><p>Certain languages, for example <a href="/wiki/Clojure" title="Clojure">Clojure</a>, <a href="/wiki/Common_Lisp" title="Common Lisp">Common Lisp</a>, or <a href="/wiki/Cython" title="Cython">Cython</a> are dynamically type checked by default, but allow programs to opt into static type checking by providing optional annotations. One reason to use such hints would be to optimize the performance of critical sections of a program. This is formalized by <a href="#Gradual_typing">gradual typing</a>. The programming environment <i><a href="/wiki/DrRacket" class="mw-redirect" title="DrRacket">DrRacket</a></i>, a pedagogic environment based on Lisp, and a precursor of the language <a href="/wiki/Racket_(programming_language)#Development" title="Racket (programming language)">Racket</a> is also soft-typed.<sup id="cite_ref-13" class="reference"><a href="#cite_note-13"><span class="cite-bracket">[</span>11<span class="cite-bracket">]</span></a></sup> </p><p>Conversely, as of version 4.0, the C# language provides a way to indicate that a variable should not be statically type checked. A variable whose type is <code>dynamic</code> will not be subject to static type checking. Instead, the program relies on runtime type information to determine how the variable may be used.<sup id="cite_ref-14" class="reference"><a href="#cite_note-14"><span class="cite-bracket">[</span>12<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-Skeet_11-2" class="reference"><a href="#cite_note-Skeet-11"><span class="cite-bracket">[</span>9<span class="cite-bracket">]</span></a></sup><sup class="reference nowrap"><span title="Page / location: 113–119">: 113–119 </span></sup> </p><p>In <a href="/wiki/Rust_(programming_language)" title="Rust (programming language)">Rust</a>, the <code class="mw-highlight mw-highlight-lang-rust mw-content-ltr" dir="ltr"><span class="k">dyn</span><span class="w"> </span><span class="n">std</span>::<span class="n">any</span>::<span class="n">Any</span></code> type provides dynamic typing of <code class="mw-highlight mw-highlight-lang-rust mw-content-ltr" dir="ltr"><span class="o">'</span><span class="nb">static</span></code> types.<sup id="cite_ref-15" class="reference"><a href="#cite_note-15"><span class="cite-bracket">[</span>13<span class="cite-bracket">]</span></a></sup> </p> <div class="mw-heading mw-heading3"><h3 id="Static_and_dynamic_type_checking_in_practice">Static and dynamic type checking in practice</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_system&action=edit&section=8" title="Edit section: Static and dynamic type checking in practice"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The choice between static and dynamic typing requires certain <a href="/wiki/Trade-off" title="Trade-off">trade-offs</a>. </p><p>Static typing can find type errors reliably at compile time, which increases the reliability of the delivered program. However, programmers disagree over how commonly type errors occur, resulting in further disagreements over the proportion of those bugs that are coded that would be caught by appropriately representing the designed types in code.<sup id="cite_ref-16" class="reference"><a href="#cite_note-16"><span class="cite-bracket">[</span>14<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-17" class="reference"><a href="#cite_note-17"><span class="cite-bracket">[</span>15<span class="cite-bracket">]</span></a></sup> Static typing advocates<sup class="noprint Inline-Template" style="white-space:nowrap;">[<i><a href="/wiki/Wikipedia:Manual_of_Style/Words_to_watch#Unsupported_attributions" title="Wikipedia:Manual of Style/Words to watch"><span title="The material near this tag possibly uses too-vague attribution or weasel words. (July 2017)">who?</span></a></i>]</sup> believe programs are more reliable when they have been well type-checked, whereas dynamic-typing advocates<sup class="noprint Inline-Template" style="white-space:nowrap;">[<i><a href="/wiki/Wikipedia:Manual_of_Style/Words_to_watch#Unsupported_attributions" title="Wikipedia:Manual of Style/Words to watch"><span title="The material near this tag possibly uses too-vague attribution or weasel words. (November 2015)">who?</span></a></i>]</sup> point to distributed code that has proven reliable and to small bug databases.<sup class="noprint Inline-Template Template-Fact" style="white-space:nowrap;">[<i><a href="/wiki/Wikipedia:Citation_needed" title="Wikipedia:Citation needed"><span title="This claim needs references to reliable sources. (November 2015)">citation needed</span></a></i>]</sup> The value of static typing increases as the strength of the type system is increased. Advocates of <a href="/wiki/Dependent_type" title="Dependent type">dependent typing</a>,<sup class="noprint Inline-Template" style="white-space:nowrap;">[<i><a href="/wiki/Wikipedia:Manual_of_Style/Words_to_watch#Unsupported_attributions" title="Wikipedia:Manual of Style/Words to watch"><span title="The material near this tag possibly uses too-vague attribution or weasel words. (July 2017)">who?</span></a></i>]</sup> implemented in languages such as <a href="/wiki/Dependent_ML" title="Dependent ML">Dependent ML</a> and <a href="/wiki/Epigram_(programming_language)" title="Epigram (programming language)">Epigram</a>, have suggested that almost all bugs can be considered type errors, if the types used in a program are properly declared by the programmer or correctly inferred by the compiler.<sup id="cite_ref-18" class="reference"><a href="#cite_note-18"><span class="cite-bracket">[</span>16<span class="cite-bracket">]</span></a></sup> </p><p>Static typing usually results in compiled code that executes faster. When the compiler knows the exact data types that are in use (which is necessary for static verification, either through declaration or inference) it can produce optimized machine code. Some dynamically typed languages such as <a href="/wiki/Common_Lisp" title="Common Lisp">Common Lisp</a> allow optional type declarations for optimization for this reason. </p><p>By contrast, dynamic typing may allow compilers to run faster and <a href="/wiki/Interpreter_(computing)" title="Interpreter (computing)">interpreters</a> to dynamically load new code, because changes to source code in dynamically typed languages may result in less checking to perform and less code to revisit.<sup class="noprint Inline-Template" style="margin-left:0.1em; white-space:nowrap;">[<i><a href="/wiki/Wikipedia:Please_clarify" title="Wikipedia:Please clarify"><span title="The text near this tag may need clarification or removal of jargon. (November 2015)">clarification needed</span></a></i>]</sup> This too may reduce the edit-compile-test-debug cycle. </p><p>Statically typed languages that lack <a href="/wiki/Type_inference" title="Type inference">type inference</a> (such as <a href="/wiki/C_(programming_language)" title="C (programming language)">C</a> and <a href="/wiki/Java_(programming_language)" title="Java (programming language)">Java</a> prior to <a href="/wiki/Java_version_history#Java_SE_10" title="Java version history">version 10</a>) require that programmers declare the types that a method or function must use. This can serve as added program documentation, that is active and dynamic, instead of static. This allows a compiler to prevent it from drifting out of synchrony, and from being ignored by programmers. However, a language can be statically typed without requiring type declarations (examples include <a href="/wiki/Haskell_(programming_language)" class="mw-redirect" title="Haskell (programming language)">Haskell</a>, <a href="/wiki/Scala_(programming_language)" title="Scala (programming language)">Scala</a>, <a href="/wiki/OCaml" title="OCaml">OCaml</a>, <a href="/wiki/F_Sharp_(programming_language)" title="F Sharp (programming language)">F#</a>, <a href="/wiki/Swift_(programming_language)" title="Swift (programming language)">Swift</a>, and to a lesser extent <a href="/wiki/C_Sharp_(programming_language)" title="C Sharp (programming language)">C#</a> and <a href="/wiki/C%2B%2B" title="C++">C++</a>), so explicit type declaration is not a necessary requirement for static typing in all languages. </p><p>Dynamic typing allows constructs that some (simple) static type checking would reject as illegal. For example, <i><a href="/wiki/Eval" title="Eval">eval</a></i> functions, which execute arbitrary data as code, become possible. An <i>eval</i> function is possible with static typing, but requires advanced uses of <a href="/wiki/GADT" class="mw-redirect" title="GADT">algebraic data types</a>. Further, dynamic typing better accommodates transitional code and prototyping, such as allowing a placeholder data structure (<a href="/wiki/Mock_object" title="Mock object">mock object</a>) to be transparently used in place of a full data structure (usually for the purposes of experimentation and testing). </p><p>Dynamic typing typically allows <a href="/wiki/Duck_typing" title="Duck typing">duck typing</a> (which enables <a href="/wiki/Duck_typing#Comparison_with_other_type_systems" title="Duck typing">easier code reuse</a>). Many<sup class="noprint Inline-Template" style="white-space:nowrap;">[<i><a href="/wiki/Wikipedia:Citing_sources" title="Wikipedia:Citing sources"><span title="Statement needs to be more specific about the content to which it refers. (July 2017)">specify</span></a></i>]</sup> languages with static typing also feature <a href="/wiki/Duck_typing#In_statically_typed_languages" title="Duck typing">duck typing</a> or other mechanisms like <a href="/wiki/Generic_programming" title="Generic programming">generic programming</a> that also enable easier code reuse. </p><p>Dynamic typing typically makes <a href="/wiki/Metaprogramming" title="Metaprogramming">metaprogramming</a> easier to use. For example, <a href="/wiki/Template_(C%2B%2B)" title="Template (C++)">C++ templates</a> are typically more cumbersome to write than the equivalent <a href="/wiki/Ruby_(programming_language)" title="Ruby (programming language)">Ruby</a> or <a href="/wiki/Python_(programming_language)" title="Python (programming language)">Python</a> code since <a href="/wiki/C%2B%2B" title="C++">C++</a> has stronger rules regarding type definitions (for both functions and variables). This forces a developer to write more <a href="/wiki/Boilerplate_code" title="Boilerplate code">boilerplate code</a> for a template than a Python developer would need to. More advanced run-time constructs such as <a href="/wiki/Metaclass" title="Metaclass">metaclasses</a> and <a href="/wiki/Introspection_(computer_science)" class="mw-redirect" title="Introspection (computer science)">introspection</a> are often harder to use in statically typed languages. In some languages, such features may also be used e.g. to generate new types and behaviors on the fly, based on run-time data. Such advanced constructs are often provided by <a href="/wiki/Dynamic_programming_language" title="Dynamic programming language">dynamic programming languages</a>; many of these are dynamically typed, although <i>dynamic typing</i> need not be related to <i>dynamic programming languages</i>. </p> <div class="mw-heading mw-heading3"><h3 id="Strong_and_weak_type_systems">Strong and weak type systems</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_system&action=edit&section=9" title="Edit section: Strong and weak type systems"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1236090951"><div role="note" class="hatnote navigation-not-searchable">Main article: <a href="/wiki/Strong_and_weak_typing" title="Strong and weak typing">Strong and weak typing</a></div> <p>Languages are often colloquially referred to as <i>strongly typed</i> or <i>weakly typed</i>. In fact, there is no universally accepted definition of what these terms mean. In general, there are more precise terms to represent the differences between type systems that lead people to call them "strong" or "weak". </p> <div class="mw-heading mw-heading3"><h3 id="Type_safety_and_memory_safety">Type safety and memory safety</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_system&action=edit&section=10" title="Edit section: Type safety and memory safety"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1236090951"><div role="note" class="hatnote navigation-not-searchable">Main articles: <a href="/wiki/Type_safety" title="Type safety">Type safety</a> and <a href="/wiki/Memory_safety" title="Memory safety">Memory safety</a></div> <p>A third way of categorizing the type system of a programming language is by the safety of typed operations and conversions. Computer scientists use the term <i>type-safe language</i> to describe languages that do not allow operations or conversions that violate the rules of the type system. </p><p>Computer scientists use the term <i>memory-safe language</i> (or just <i>safe language</i>) to describe languages that do not allow programs to access memory that has not been assigned for their use. For example, a memory-safe language will <a href="/wiki/Bounds_checking" title="Bounds checking">check array bounds</a>, or else statically guarantee (i.e., at compile time before execution) that array accesses out of the array boundaries will cause compile-time and perhaps runtime errors. </p><p>Consider the following program of a language that is both type-safe and memory-safe:<sup id="cite_ref-19" class="reference"><a href="#cite_note-19"><span class="cite-bracket">[</span>17<span class="cite-bracket">]</span></a></sup> </p> <div class="mw-highlight mw-highlight-lang-text mw-content-ltr" dir="ltr"><pre><span></span>var x := 5; var y := "37"; var z := x + y; </pre></div> <p>In this example, the variable <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">z</code> will have the value 42. Although this may not be what the programmer anticipated, it is a well-defined result. If <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">y</code> were a different string, one that could not be converted to a number (e.g. "Hello World"), the result would be well-defined as well. Note that a program can be type-safe or memory-safe and still crash on an invalid operation. This is for languages where the type system is not sufficiently advanced to precisely specify the validity of operations on all possible operands. But if a program encounters an operation that is not type-safe, terminating the program is often the only option. </p><p>Now consider a similar example in C: </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="kt">int</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">5</span><span class="p">;</span> <span class="kt">char</span><span class="w"> </span><span class="n">y</span><span class="p">[]</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">"37"</span><span class="p">;</span> <span class="kt">char</span><span class="o">*</span><span class="w"> </span><span class="n">z</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="n">y</span><span class="p">;</span> <span class="n">printf</span><span class="p">(</span><span class="s">"%c</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span><span class="w"> </span><span class="o">*</span><span class="n">z</span><span class="p">);</span> </pre></div> <p>In this example <code class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><span class="n">z</span></code> will point to a memory address five characters beyond <code class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><span class="n">y</span></code>, equivalent to three characters after the terminating zero character of the string pointed to by <code class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><span class="n">y</span></code>. This is memory that the program is not expected to access. In C terms this is simply <a href="/wiki/Undefined_behaviour" class="mw-redirect" title="Undefined behaviour">undefined behaviour</a> and the program may do anything; with a simple compiler it might actually print whatever byte is stored after the string "37". As this example shows, C is not memory-safe. As arbitrary data was assumed to be a character, it is also not a type-safe language. </p><p>In general, type-safety and memory-safety go hand in hand. For example, a language that supports pointer arithmetic and number-to-pointer conversions (like C) is neither memory-safe nor type-safe, because it allows arbitrary memory to be accessed as if it were valid memory of any type. </p> <div class="mw-heading mw-heading3"><h3 id="Variable_levels_of_type_checking">Variable levels of type checking</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_system&action=edit&section=11" title="Edit section: Variable levels of type checking"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Some languages allow different levels of checking to apply to different regions of code. Examples include: </p> <ul><li>The <code>use strict</code> directive in <a href="/wiki/JavaScript" title="JavaScript">JavaScript</a><sup id="cite_ref-20" class="reference"><a href="#cite_note-20"><span class="cite-bracket">[</span>18<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-21" class="reference"><a href="#cite_note-21"><span class="cite-bracket">[</span>19<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-22" class="reference"><a href="#cite_note-22"><span class="cite-bracket">[</span>20<span class="cite-bracket">]</span></a></sup> and <a href="/wiki/Perl" title="Perl">Perl</a> applies stronger checking.</li> <li>The <code>declare(strict_types=1)</code> in <a href="/wiki/PHP" title="PHP">PHP</a><sup id="cite_ref-23" class="reference"><a href="#cite_note-23"><span class="cite-bracket">[</span>21<span class="cite-bracket">]</span></a></sup> on a per-file basis allows only a variable of exact type of the type declaration will be accepted, or a <code>TypeError</code> will be thrown.</li> <li>The <code lang="vb">Option Strict On</code> in <a href="/wiki/VB.NET" class="mw-redirect" title="VB.NET">VB.NET</a> allows the compiler to require a conversion between objects.</li></ul> <p>Additional tools such as <a href="/wiki/Lint_(software)" title="Lint (software)">lint</a> and <a href="/wiki/IBM_Rational_Purify" class="mw-redirect" title="IBM Rational Purify">IBM Rational Purify</a> can also be used to achieve a higher level of strictness. </p> <div class="mw-heading mw-heading3"><h3 id="Optional_type_systems">Optional type systems</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_system&action=edit&section=12" title="Edit section: Optional type systems"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>It has been proposed, chiefly by <a href="/wiki/Gilad_Bracha" title="Gilad Bracha">Gilad Bracha</a>, that the choice of type system be made independent of choice of language; that a type system should be a module that can be <i>plugged</i> into a language as needed. He believes this is advantageous, because what he calls mandatory type systems make languages less expressive and code more fragile.<sup id="cite_ref-Bracha_24-0" class="reference"><a href="#cite_note-Bracha-24"><span class="cite-bracket">[</span>22<span class="cite-bracket">]</span></a></sup> The requirement that the type system does not affect the semantics of the language is difficult to fulfill. </p><p>Optional typing is related to, but distinct from, <a href="/wiki/Gradual_typing" title="Gradual typing">gradual typing</a>. While both typing disciplines can be used to perform static analysis of code (<a href="/wiki/Static_typing" class="mw-redirect" title="Static typing">static typing</a>), optional type systems do not enforce type safety at runtime (<a href="/wiki/Dynamic_typing" class="mw-redirect" title="Dynamic typing">dynamic typing</a>).<sup id="cite_ref-Bracha_24-1" class="reference"><a href="#cite_note-Bracha-24"><span class="cite-bracket">[</span>22<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-25" class="reference"><a href="#cite_note-25"><span class="cite-bracket">[</span>23<span class="cite-bracket">]</span></a></sup> </p> <div class="mw-heading mw-heading2"><h2 id="Polymorphism_and_types">Polymorphism and types</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_system&action=edit&section=13" title="Edit section: Polymorphism and types"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1236090951"><div role="note" class="hatnote navigation-not-searchable">Main article: <a href="/wiki/Polymorphism_(computer_science)" title="Polymorphism (computer science)">Polymorphism (computer science)</a></div> <p>The term <i>polymorphism</i> refers to the ability of code (especially, functions or classes) to act on values of multiple types, or to the ability of different instances of the same data structure to contain elements of different types. Type systems that allow polymorphism generally do so in order to improve the potential for code re-use: in a language with polymorphism, programmers need only implement a data structure such as a list or an <a href="/wiki/Associative_array" title="Associative array">associative array</a> once, rather than once for each type of element with which they plan to use it. For this reason computer scientists sometimes call the use of certain forms of polymorphism <i><a href="/wiki/Generic_programming" title="Generic programming">generic programming</a></i>. The type-theoretic foundations of polymorphism are closely related to those of <a href="/wiki/Abstraction_(computer_science)" title="Abstraction (computer science)">abstraction</a>, <a href="/wiki/Module_(programming)" class="mw-redirect" title="Module (programming)">modularity</a> and (in some cases) <a href="/wiki/Subtyping" title="Subtyping">subtyping</a>. </p> <div class="mw-heading mw-heading2"><h2 id="Specialized_type_systems">Specialized type systems</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_system&action=edit&section=14" title="Edit section: Specialized type systems"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Many type systems have been created that are specialized for use in certain environments with certain types of data, or for out-of-band <a href="/wiki/Static_program_analysis" title="Static program analysis">static program analysis</a>. Frequently, these are based on ideas from formal <a href="/wiki/Type_theory" title="Type theory">type theory</a> and are only available as part of prototype research systems. </p><p>The following table gives an overview over type theoretic concepts that are used in specialized type systems. The names <span class="texhtml mvar" style="font-style:italic;">M, N, O</span> range over terms and the names <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \sigma ,\tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>σ<!-- σ --></mi> <mo>,</mo> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \sigma ,\tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/5413ff7af6a852a9f408ceebcbae14b523e082a2" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.671ex; width:3.566ex; height:2.009ex;" alt="{\displaystyle \sigma ,\tau }"></span> range over types. The following notation will be used: </p> <ul><li><span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle M:\sigma }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>M</mi> <mo>:</mo> <mi>σ<!-- σ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle M:\sigma }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/d19edef7b46722a36691321bc46d47dfb44ed7a9" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:5.709ex; height:2.176ex;" alt="{\displaystyle M:\sigma }"></span> means that <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle M}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>M</mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle M}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/f82cade9898ced02fdd08712e5f0c0151758a0dd" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:2.442ex; height:2.176ex;" alt="{\displaystyle M}"></span> has type <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \sigma }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>σ<!-- σ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \sigma }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/59f59b7c3e6fdb1d0365a494b81fb9a696138c36" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:1.33ex; height:1.676ex;" alt="{\displaystyle \sigma }"></span>;</li> <li><span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle M(N)}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>M</mi> <mo stretchy="false">(</mo> <mi>N</mi> <mo stretchy="false">)</mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle M(N)}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/c9625cd78ee58da84ad5ea620df5441d81058aba" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:6.315ex; height:2.843ex;" alt="{\displaystyle M(N)}"></span> is that application of <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle M}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>M</mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle M}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/f82cade9898ced02fdd08712e5f0c0151758a0dd" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:2.442ex; height:2.176ex;" alt="{\displaystyle M}"></span> on <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle N}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>N</mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle N}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/f5e3890c981ae85503089652feb48b191b57aae3" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:2.064ex; height:2.176ex;" alt="{\displaystyle N}"></span>;</li> <li><span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \tau [\alpha :=\sigma ]}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>τ<!-- τ --></mi> <mo stretchy="false">[</mo> <mi>α<!-- α --></mi> <mo>:=</mo> <mi>σ<!-- σ --></mi> <mo stretchy="false">]</mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \tau [\alpha :=\sigma ]}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/2c9f20140a5b2c9c8c251fd7995c0946af39ff50" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:9.058ex; height:2.843ex;" alt="{\displaystyle \tau [\alpha :=\sigma ]}"></span> (resp. <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \tau [x:=N]}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>τ<!-- τ --></mi> <mo stretchy="false">[</mo> <mi>x</mi> <mo>:=</mo> <mi>N</mi> <mo stretchy="false">]</mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \tau [x:=N]}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/c002d47c768eee1680120285b350790d373dbf23" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:9.634ex; height:2.843ex;" alt="{\displaystyle \tau [x:=N]}"></span>) describes the type which results from replacing all occurrences of the type variable <span class="texhtml mvar" style="font-style:italic;">α</span> (resp. term variable <span class="texhtml mvar" style="font-style:italic;">x</span>) in <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/38a7dcde9730ef0853809fefc18d88771f95206c" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:1.202ex; height:1.676ex;" alt="{\displaystyle \tau }"></span> by the type <span class="texhtml mvar" style="font-style:italic;">σ</span> (resp. term <span class="texhtml mvar" style="font-style:italic;">N</span>).</li></ul> <table class="wikitable"> <tbody><tr> <th>Type notion</th> <th>Notation</th> <th>Meaning </th></tr> <tr> <td><a href="/wiki/Function_type" title="Function type">Function</a> </td> <td><span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \sigma \to \tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>σ<!-- σ --></mi> <mo stretchy="false">→<!-- → --></mo> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \sigma \to \tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/a302f678cb66629c99c4d62a6a9894926c1359e0" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:6.146ex; height:1.843ex;" alt="{\displaystyle \sigma \to \tau }"></span> </td> <td>If <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle M:\sigma \to \tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>M</mi> <mo>:</mo> <mi>σ<!-- σ --></mi> <mo stretchy="false">→<!-- → --></mo> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle M:\sigma \to \tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/398b21c2b2a48db6b6d2a9e57cfe64d33d572357" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:10.525ex; height:2.176ex;" alt="{\displaystyle M:\sigma \to \tau }"></span> and <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle N:\sigma }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>N</mi> <mo>:</mo> <mi>σ<!-- σ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle N:\sigma }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/7553daea0ec18c652b6b0ce3cafdd0095f7d567f" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:5.33ex; height:2.176ex;" alt="{\displaystyle N:\sigma }"></span>, then <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle M(N):\tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>M</mi> <mo stretchy="false">(</mo> <mi>N</mi> <mo stretchy="false">)</mo> <mo>:</mo> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle M(N):\tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/46df294e5107191752ce1d08864502a559ea889b" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:9.454ex; height:2.843ex;" alt="{\displaystyle M(N):\tau }"></span>. </td></tr> <tr> <td><a href="/wiki/Product_type" title="Product type">Product</a> </td> <td><span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \sigma \times \tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>σ<!-- σ --></mi> <mo>×<!-- × --></mo> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \sigma \times \tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/41d220d822609afc1cc7ab5fc11383c54dee2ab4" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:5.372ex; height:1.676ex;" alt="{\displaystyle \sigma \times \tau }"></span> </td> <td>If <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle M:\sigma \times \tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>M</mi> <mo>:</mo> <mi>σ<!-- σ --></mi> <mo>×<!-- × --></mo> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle M:\sigma \times \tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/4d9a436feb0fc88a9eef11f73b595a5d05897af6" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:9.751ex; height:2.176ex;" alt="{\displaystyle M:\sigma \times \tau }"></span>, then <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle M=(N,O)}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>M</mi> <mo>=</mo> <mo stretchy="false">(</mo> <mi>N</mi> <mo>,</mo> <mi>O</mi> <mo stretchy="false">)</mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle M=(N,O)}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/6db067f5da536e89b37830133065eb7df6dfaf43" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:12.221ex; height:2.843ex;" alt="{\displaystyle M=(N,O)}"></span> is a pair s.t. <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle N:\sigma }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>N</mi> <mo>:</mo> <mi>σ<!-- σ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle N:\sigma }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/7553daea0ec18c652b6b0ce3cafdd0095f7d567f" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:5.33ex; height:2.176ex;" alt="{\displaystyle N:\sigma }"></span> and <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle O:\tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>O</mi> <mo>:</mo> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle O:\tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/4cf7d9b96135e04ea95cf94ea70575be121567fa" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:4.912ex; height:2.176ex;" alt="{\displaystyle O:\tau }"></span>. </td></tr> <tr> <td><a href="/wiki/Sum_type" class="mw-redirect" title="Sum type">Sum</a> </td> <td><span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \sigma +\tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>σ<!-- σ --></mi> <mo>+</mo> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \sigma +\tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/8d16054fce992310b881b3fa7ae510bb026f6740" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.505ex; width:5.372ex; height:2.176ex;" alt="{\displaystyle \sigma +\tau }"></span> </td> <td>If <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle M:\sigma +\tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>M</mi> <mo>:</mo> <mi>σ<!-- σ --></mi> <mo>+</mo> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle M:\sigma +\tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/234aa83f93cef1b00706bddced4290638f80edad" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.505ex; width:9.751ex; height:2.343ex;" alt="{\displaystyle M:\sigma +\tau }"></span>, then <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle M=\iota _{1}(N)}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>M</mi> <mo>=</mo> <msub> <mi>ι<!-- ι --></mi> <mrow class="MJX-TeXAtom-ORD"> <mn>1</mn> </mrow> </msub> <mo stretchy="false">(</mo> <mi>N</mi> <mo stretchy="false">)</mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle M=\iota _{1}(N)}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/65befe4cfc3eb1c85ef528623087a1fef2cfc98b" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:11.291ex; height:2.843ex;" alt="{\displaystyle M=\iota _{1}(N)}"></span> is the first injection s.t. <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle N:\sigma }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>N</mi> <mo>:</mo> <mi>σ<!-- σ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle N:\sigma }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/7553daea0ec18c652b6b0ce3cafdd0095f7d567f" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:5.33ex; height:2.176ex;" alt="{\displaystyle N:\sigma }"></span>, or <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle M=\iota _{2}(N)}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>M</mi> <mo>=</mo> <msub> <mi>ι<!-- ι --></mi> <mrow class="MJX-TeXAtom-ORD"> <mn>2</mn> </mrow> </msub> <mo stretchy="false">(</mo> <mi>N</mi> <mo stretchy="false">)</mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle M=\iota _{2}(N)}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/60740a8f54201878b13dd450eb79c09f189a247c" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:11.291ex; height:2.843ex;" alt="{\displaystyle M=\iota _{2}(N)}"></span> is the second injection s.t. <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle N:\tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>N</mi> <mo>:</mo> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle N:\tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/9b3049fd513698dc16655b2776a702ef0b91f43e" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:5.203ex; height:2.176ex;" alt="{\displaystyle N:\tau }"></span>. </td></tr> <tr> <td><a href="/wiki/Intersection_type" title="Intersection type">Intersection</a> </td> <td><span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \sigma \cap \tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>σ<!-- σ --></mi> <mo>∩<!-- ∩ --></mo> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \sigma \cap \tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/f1b5fbc85a391ea8ded8940802c28265a131830b" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:5.114ex; height:2.009ex;" alt="{\displaystyle \sigma \cap \tau }"></span> </td> <td>If <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle M:\sigma \cap \tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>M</mi> <mo>:</mo> <mi>σ<!-- σ --></mi> <mo>∩<!-- ∩ --></mo> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle M:\sigma \cap \tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/e483f2d888c01ff3de04733d97ec1ed8c67e6779" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:9.494ex; height:2.176ex;" alt="{\displaystyle M:\sigma \cap \tau }"></span>, then <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle M:\sigma }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>M</mi> <mo>:</mo> <mi>σ<!-- σ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle M:\sigma }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/d19edef7b46722a36691321bc46d47dfb44ed7a9" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:5.709ex; height:2.176ex;" alt="{\displaystyle M:\sigma }"></span> and <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle M:\tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>M</mi> <mo>:</mo> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle M:\tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/9358c383b9b58b144f8b476b2191f3f14780f7b9" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:5.581ex; height:2.176ex;" alt="{\displaystyle M:\tau }"></span>. </td></tr> <tr> <td><a href="/wiki/Union_type" title="Union type">Union</a> </td> <td><span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \sigma \cup \tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>σ<!-- σ --></mi> <mo>∪<!-- ∪ --></mo> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \sigma \cup \tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/92d94575c56a6d16f42c8dabc46c409b4a9830f1" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:5.114ex; height:2.009ex;" alt="{\displaystyle \sigma \cup \tau }"></span> </td> <td>If <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle M:\sigma \cup \tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>M</mi> <mo>:</mo> <mi>σ<!-- σ --></mi> <mo>∪<!-- ∪ --></mo> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle M:\sigma \cup \tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/760e48c93e811650170c1a14a3a68e62de21e45c" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:9.494ex; height:2.176ex;" alt="{\displaystyle M:\sigma \cup \tau }"></span>, then <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle M:\sigma }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>M</mi> <mo>:</mo> <mi>σ<!-- σ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle M:\sigma }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/d19edef7b46722a36691321bc46d47dfb44ed7a9" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:5.709ex; height:2.176ex;" alt="{\displaystyle M:\sigma }"></span> or <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle M:\tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>M</mi> <mo>:</mo> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle M:\tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/9358c383b9b58b144f8b476b2191f3f14780f7b9" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:5.581ex; height:2.176ex;" alt="{\displaystyle M:\tau }"></span>. </td></tr> <tr> <td><a href="/wiki/Record_(computer_science)" title="Record (computer science)">Record</a> </td> <td><span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \langle x:\tau \rangle }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mo fence="false" stretchy="false">⟨<!-- ⟨ --></mo> <mi>x</mi> <mo>:</mo> <mi>τ<!-- τ --></mi> <mo fence="false" stretchy="false">⟩<!-- ⟩ --></mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \langle x:\tau \rangle }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/3884e36a2a2b6d3353746cb28ab41b0e8ce434c1" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:6.278ex; height:2.843ex;" alt="{\displaystyle \langle x:\tau \rangle }"></span> </td> <td>If <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle M:\langle x:\tau \rangle }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>M</mi> <mo>:</mo> <mo fence="false" stretchy="false">⟨<!-- ⟨ --></mo> <mi>x</mi> <mo>:</mo> <mi>τ<!-- τ --></mi> <mo fence="false" stretchy="false">⟩<!-- ⟩ --></mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle M:\langle x:\tau \rangle }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/96f3b7a0ff7f8fb708609ce31816bfb1dd817b6d" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:10.657ex; height:2.843ex;" alt="{\displaystyle M:\langle x:\tau \rangle }"></span>, then <span class="texhtml mvar" style="font-style:italic;">M</span> has a member <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle x:\tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>x</mi> <mo>:</mo> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle x:\tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/2ac0bf4095c363981b5860e036ecdbad562f1f28" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:4.469ex; height:1.676ex;" alt="{\displaystyle x:\tau }"></span>. </td></tr> <tr> <td><a href="/wiki/Parametric_polymorphism" title="Parametric polymorphism">Polymorphic</a> </td> <td><span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \forall {}\alpha .\tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi mathvariant="normal">∀<!-- ∀ --></mi> <mrow class="MJX-TeXAtom-ORD"> </mrow> <mi>α<!-- α --></mi> <mo>.</mo> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \forall {}\alpha .\tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/7aa8708e64563ed19b49d18a17462ecfaba00224" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:5.016ex; height:2.176ex;" alt="{\displaystyle \forall {}\alpha .\tau }"></span> </td> <td>If <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle M:\forall {}\alpha .\tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>M</mi> <mo>:</mo> <mi mathvariant="normal">∀<!-- ∀ --></mi> <mrow class="MJX-TeXAtom-ORD"> </mrow> <mi>α<!-- α --></mi> <mo>.</mo> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle M:\forall {}\alpha .\tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/b424ef02e704f7637a43a0b46f27cb14f6a64252" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:9.395ex; height:2.176ex;" alt="{\displaystyle M:\forall {}\alpha .\tau }"></span>, then <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle M:\tau [\alpha :=\sigma ]}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>M</mi> <mo>:</mo> <mi>τ<!-- τ --></mi> <mo stretchy="false">[</mo> <mi>α<!-- α --></mi> <mo>:=</mo> <mi>σ<!-- σ --></mi> <mo stretchy="false">]</mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle M:\tau [\alpha :=\sigma ]}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/cc6e7b7100ba437f837098bdc636cab94c7d5ef2" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:13.438ex; height:2.843ex;" alt="{\displaystyle M:\tau [\alpha :=\sigma ]}"></span> for any type <span class="texhtml mvar" style="font-style:italic;">σ</span>. </td></tr> <tr> <td><a href="/wiki/Existential_type" class="mw-redirect" title="Existential type">Existential</a> </td> <td><span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \exists {}\alpha .\tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi mathvariant="normal">∃<!-- ∃ --></mi> <mrow class="MJX-TeXAtom-ORD"> </mrow> <mi>α<!-- α --></mi> <mo>.</mo> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \exists {}\alpha .\tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/8edfaf8b308e4b62dbd52e9bad8c15568fc004ba" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:5.016ex; height:2.176ex;" alt="{\displaystyle \exists {}\alpha .\tau }"></span> </td> <td>If <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle M:\exists {}\alpha .\tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>M</mi> <mo>:</mo> <mi mathvariant="normal">∃<!-- ∃ --></mi> <mrow class="MJX-TeXAtom-ORD"> </mrow> <mi>α<!-- α --></mi> <mo>.</mo> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle M:\exists {}\alpha .\tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/133cbbf0c4f398ccb7b97040e37311adb22b6874" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:9.395ex; height:2.176ex;" alt="{\displaystyle M:\exists {}\alpha .\tau }"></span>, then <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle M:\tau [\alpha :=\sigma ]}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>M</mi> <mo>:</mo> <mi>τ<!-- τ --></mi> <mo stretchy="false">[</mo> <mi>α<!-- α --></mi> <mo>:=</mo> <mi>σ<!-- σ --></mi> <mo stretchy="false">]</mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle M:\tau [\alpha :=\sigma ]}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/cc6e7b7100ba437f837098bdc636cab94c7d5ef2" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:13.438ex; height:2.843ex;" alt="{\displaystyle M:\tau [\alpha :=\sigma ]}"></span> for some type <span class="texhtml mvar" style="font-style:italic;">σ</span>. </td></tr> <tr> <td><a href="/wiki/Recursive_type" class="mw-redirect" title="Recursive type">Recursive</a> </td> <td><span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \mu \alpha .\tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>μ<!-- μ --></mi> <mi>α<!-- α --></mi> <mo>.</mo> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \mu \alpha .\tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/1324b2ede74b82c7ae7ddc0e3ea174c7cf176744" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:5.125ex; height:2.176ex;" alt="{\displaystyle \mu \alpha .\tau }"></span> </td> <td>If <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle M:\mu \alpha .\tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>M</mi> <mo>:</mo> <mi>μ<!-- μ --></mi> <mi>α<!-- α --></mi> <mo>.</mo> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle M:\mu \alpha .\tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/9ccc8e7092a3043dffbe009636020be636882f0a" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:9.505ex; height:2.676ex;" alt="{\displaystyle M:\mu \alpha .\tau }"></span>, then <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle M:\tau [\alpha :=\mu \alpha .\tau ]}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>M</mi> <mo>:</mo> <mi>τ<!-- τ --></mi> <mo stretchy="false">[</mo> <mi>α<!-- α --></mi> <mo>:=</mo> <mi>μ<!-- μ --></mi> <mi>α<!-- α --></mi> <mo>.</mo> <mi>τ<!-- τ --></mi> <mo stretchy="false">]</mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle M:\tau [\alpha :=\mu \alpha .\tau ]}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/ac9df94172e1adad113ada00ba07ecab8c976ef3" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:17.233ex; height:2.843ex;" alt="{\displaystyle M:\tau [\alpha :=\mu \alpha .\tau ]}"></span>. </td></tr> <tr> <td><a href="/wiki/Dependent_type#Pi_type" title="Dependent type">Dependent function</a><sup id="cite_ref-26" class="reference"><a href="#cite_note-26"><span class="cite-bracket">[</span>a<span class="cite-bracket">]</span></a></sup> </td> <td><span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle (x:\sigma )\to \tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mo stretchy="false">(</mo> <mi>x</mi> <mo>:</mo> <mi>σ<!-- σ --></mi> <mo stretchy="false">)</mo> <mo stretchy="false">→<!-- → --></mo> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle (x:\sigma )\to \tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/bbbb7d9ac151ca4cd25dcc4d28ea3b5ac661916d" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:11.222ex; height:2.843ex;" alt="{\displaystyle (x:\sigma )\to \tau }"></span> </td> <td>If <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle M:(x:\sigma )\to \tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>M</mi> <mo>:</mo> <mo stretchy="false">(</mo> <mi>x</mi> <mo>:</mo> <mi>σ<!-- σ --></mi> <mo stretchy="false">)</mo> <mo stretchy="false">→<!-- → --></mo> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle M:(x:\sigma )\to \tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/3fa21ca3255f4b830efb9c2e2dfe1f7e9aca115d" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:15.601ex; height:2.843ex;" alt="{\displaystyle M:(x:\sigma )\to \tau }"></span> and <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle N:\sigma }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>N</mi> <mo>:</mo> <mi>σ<!-- σ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle N:\sigma }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/7553daea0ec18c652b6b0ce3cafdd0095f7d567f" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:5.33ex; height:2.176ex;" alt="{\displaystyle N:\sigma }"></span>, then <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle M(N):\tau [x:=N]}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>M</mi> <mo stretchy="false">(</mo> <mi>N</mi> <mo stretchy="false">)</mo> <mo>:</mo> <mi>τ<!-- τ --></mi> <mo stretchy="false">[</mo> <mi>x</mi> <mo>:=</mo> <mi>N</mi> <mo stretchy="false">]</mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle M(N):\tau [x:=N]}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/fe8fbfbf47cd87c4d5764a533c69783e0c8c4a0f" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:17.887ex; height:2.843ex;" alt="{\displaystyle M(N):\tau [x:=N]}"></span>. </td></tr> <tr> <td><a href="/wiki/Dependent_type#Sigma_type" title="Dependent type">Dependent pair</a><sup id="cite_ref-27" class="reference"><a href="#cite_note-27"><span class="cite-bracket">[</span>b<span class="cite-bracket">]</span></a></sup> </td> <td><span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle (x:\sigma )\times \tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mo stretchy="false">(</mo> <mi>x</mi> <mo>:</mo> <mi>σ<!-- σ --></mi> <mo stretchy="false">)</mo> <mo>×<!-- × --></mo> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle (x:\sigma )\times \tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/cdc51bdccb961bcb4375c3231dc8a36825c77d0a" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:10.448ex; height:2.843ex;" alt="{\displaystyle (x:\sigma )\times \tau }"></span> </td> <td>If <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle M:(x:\sigma )\times \tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>M</mi> <mo>:</mo> <mo stretchy="false">(</mo> <mi>x</mi> <mo>:</mo> <mi>σ<!-- σ --></mi> <mo stretchy="false">)</mo> <mo>×<!-- × --></mo> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle M:(x:\sigma )\times \tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/69a46e6a2be97d2c173fd22b6e939cf22fac423f" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:14.828ex; height:2.843ex;" alt="{\displaystyle M:(x:\sigma )\times \tau }"></span>, then <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle M=(N,O)}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>M</mi> <mo>=</mo> <mo stretchy="false">(</mo> <mi>N</mi> <mo>,</mo> <mi>O</mi> <mo stretchy="false">)</mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle M=(N,O)}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/6db067f5da536e89b37830133065eb7df6dfaf43" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:12.221ex; height:2.843ex;" alt="{\displaystyle M=(N,O)}"></span> is a pair s.t. <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle N:\sigma }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>N</mi> <mo>:</mo> <mi>σ<!-- σ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle N:\sigma }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/7553daea0ec18c652b6b0ce3cafdd0095f7d567f" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:5.33ex; height:2.176ex;" alt="{\displaystyle N:\sigma }"></span> and <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle O:\tau [x:=N]}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>O</mi> <mo>:</mo> <mi>τ<!-- τ --></mi> <mo stretchy="false">[</mo> <mi>x</mi> <mo>:=</mo> <mi>N</mi> <mo stretchy="false">]</mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle O:\tau [x:=N]}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/4f1e073d48b8fe72f0ada96078ea802665ea09bf" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:13.345ex; height:2.843ex;" alt="{\displaystyle O:\tau [x:=N]}"></span>. </td></tr> <tr> <td><a href="/wiki/Intersection_type#Dependent_intersection_type" title="Intersection type">Dependent intersection</a><sup id="cite_ref-K03_28-0" class="reference"><a href="#cite_note-K03-28"><span class="cite-bracket">[</span>24<span class="cite-bracket">]</span></a></sup> </td> <td><span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle (x:\sigma )\cap \tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mo stretchy="false">(</mo> <mi>x</mi> <mo>:</mo> <mi>σ<!-- σ --></mi> <mo stretchy="false">)</mo> <mo>∩<!-- ∩ --></mo> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle (x:\sigma )\cap \tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/1d1582886a9278c7fc635dac09779d9546f7a372" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:10.19ex; height:2.843ex;" alt="{\displaystyle (x:\sigma )\cap \tau }"></span> </td> <td>If <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle M:(x:\sigma )\cap \tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>M</mi> <mo>:</mo> <mo stretchy="false">(</mo> <mi>x</mi> <mo>:</mo> <mi>σ<!-- σ --></mi> <mo stretchy="false">)</mo> <mo>∩<!-- ∩ --></mo> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle M:(x:\sigma )\cap \tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/c21a5866fffbd29443fb640983ce6da751bd8439" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:14.57ex; height:2.843ex;" alt="{\displaystyle M:(x:\sigma )\cap \tau }"></span>, then <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle M:\sigma }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>M</mi> <mo>:</mo> <mi>σ<!-- σ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle M:\sigma }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/d19edef7b46722a36691321bc46d47dfb44ed7a9" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:5.709ex; height:2.176ex;" alt="{\displaystyle M:\sigma }"></span> and <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle M:\tau [x:=M]}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>M</mi> <mo>:</mo> <mi>τ<!-- τ --></mi> <mo stretchy="false">[</mo> <mi>x</mi> <mo>:=</mo> <mi>M</mi> <mo stretchy="false">]</mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle M:\tau [x:=M]}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/fbae24869bf3414d644e146189d2b8a911a7ea12" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:14.392ex; height:2.843ex;" alt="{\displaystyle M:\tau [x:=M]}"></span>. </td></tr> <tr> <td><a href="/wiki/Intersection_type#Intersection_of_a_type_family" title="Intersection type">Familial intersection</a><sup id="cite_ref-K03_28-1" class="reference"><a href="#cite_note-K03-28"><span class="cite-bracket">[</span>24<span class="cite-bracket">]</span></a></sup> </td> <td><span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \bigcap _{x:\sigma }\tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <munder> <mo>⋂<!-- ⋂ --></mo> <mrow class="MJX-TeXAtom-ORD"> <mi>x</mi> <mo>:</mo> <mi>σ<!-- σ --></mi> </mrow> </munder> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \bigcap _{x:\sigma }\tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/d630101dd090cfe57b6cf1597f19396c29804588" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -3.005ex; width:4.171ex; height:5.509ex;" alt="{\displaystyle \bigcap _{x:\sigma }\tau }"></span> </td> <td>If <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\textstyle M:\bigcap _{x:\sigma }\tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="false" scriptlevel="0"> <mi>M</mi> <mo>:</mo> <munder> <mo>⋂<!-- ⋂ --></mo> <mrow class="MJX-TeXAtom-ORD"> <mi>x</mi> <mo>:</mo> <mi>σ<!-- σ --></mi> </mrow> </munder> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\textstyle M:\bigcap _{x:\sigma }\tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/c0d9897cc3eeaa76e06607f55f66de5216f6365c" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -1.005ex; width:10.474ex; height:3.009ex;" alt="{\textstyle M:\bigcap _{x:\sigma }\tau }"></span>, then <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle M:\tau [x:=N]}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>M</mi> <mo>:</mo> <mi>τ<!-- τ --></mi> <mo stretchy="false">[</mo> <mi>x</mi> <mo>:=</mo> <mi>N</mi> <mo stretchy="false">]</mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle M:\tau [x:=N]}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/b5409c0f1beac70825e9dc0e3313b42012f40a2d" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:14.014ex; height:2.843ex;" alt="{\displaystyle M:\tau [x:=N]}"></span> for any term <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle N:\sigma }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>N</mi> <mo>:</mo> <mi>σ<!-- σ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle N:\sigma }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/7553daea0ec18c652b6b0ce3cafdd0095f7d567f" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:5.33ex; height:2.176ex;" alt="{\displaystyle N:\sigma }"></span>. </td></tr> <tr> <td>Familial union<sup id="cite_ref-K03_28-2" class="reference"><a href="#cite_note-K03-28"><span class="cite-bracket">[</span>24<span class="cite-bracket">]</span></a></sup> </td> <td><span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \bigcup _{x:\sigma }\tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <munder> <mo>⋃<!-- ⋃ --></mo> <mrow class="MJX-TeXAtom-ORD"> <mi>x</mi> <mo>:</mo> <mi>σ<!-- σ --></mi> </mrow> </munder> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \bigcup _{x:\sigma }\tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/f27acf8fd25e0bf87a8ac9c019343e17a01294a8" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -3.005ex; width:4.171ex; height:5.509ex;" alt="{\displaystyle \bigcup _{x:\sigma }\tau }"></span> </td> <td>If <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\textstyle M:\bigcup _{x:\sigma }\tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="false" scriptlevel="0"> <mi>M</mi> <mo>:</mo> <munder> <mo>⋃<!-- ⋃ --></mo> <mrow class="MJX-TeXAtom-ORD"> <mi>x</mi> <mo>:</mo> <mi>σ<!-- σ --></mi> </mrow> </munder> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\textstyle M:\bigcup _{x:\sigma }\tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/13638cd2eee5a024211b0d07ddfce1fdfa21245c" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -1.005ex; width:10.474ex; height:3.009ex;" alt="{\textstyle M:\bigcup _{x:\sigma }\tau }"></span>, then <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle M:\tau [x:=N]}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>M</mi> <mo>:</mo> <mi>τ<!-- τ --></mi> <mo stretchy="false">[</mo> <mi>x</mi> <mo>:=</mo> <mi>N</mi> <mo stretchy="false">]</mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle M:\tau [x:=N]}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/b5409c0f1beac70825e9dc0e3313b42012f40a2d" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:14.014ex; height:2.843ex;" alt="{\displaystyle M:\tau [x:=N]}"></span> for some term <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle N:\sigma }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>N</mi> <mo>:</mo> <mi>σ<!-- σ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle N:\sigma }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/7553daea0ec18c652b6b0ce3cafdd0095f7d567f" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:5.33ex; height:2.176ex;" alt="{\displaystyle N:\sigma }"></span>. </td></tr></tbody></table> <style data-mw-deduplicate="TemplateStyles:r1239543626">.mw-parser-output .reflist{margin-bottom:0.5em;list-style-type:decimal}@media screen{.mw-parser-output .reflist{font-size:90%}}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}</style><div class="reflist reflist-lower-alpha"> <div class="mw-references-wrap"><ol class="references"> <li id="cite_note-26"><span class="mw-cite-backlink"><b><a href="#cite_ref-26">^</a></b></span> <span class="reference-text">Also referred to as <i>dependent product type</i>, since <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\textstyle (x:\sigma )\to \tau =\prod _{x:\sigma }\tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="false" scriptlevel="0"> <mo stretchy="false">(</mo> <mi>x</mi> <mo>:</mo> <mi>σ<!-- σ --></mi> <mo stretchy="false">)</mo> <mo stretchy="false">→<!-- → --></mo> <mi>τ<!-- τ --></mi> <mo>=</mo> <munder> <mo>∏<!-- ∏ --></mo> <mrow class="MJX-TeXAtom-ORD"> <mi>x</mi> <mo>:</mo> <mi>σ<!-- σ --></mi> </mrow> </munder> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\textstyle (x:\sigma )\to \tau =\prod _{x:\sigma }\tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/e6240662486d75eeca20d70a294d7fadd3197bde" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -1.005ex; width:20.673ex; height:3.009ex;" alt="{\textstyle (x:\sigma )\to \tau =\prod _{x:\sigma }\tau }"></span>.</span> </li> <li id="cite_note-27"><span class="mw-cite-backlink"><b><a href="#cite_ref-27">^</a></b></span> <span class="reference-text">Also referred to as <i>dependent sum type</i>, since <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\textstyle (x:\sigma )\times \tau =\sum _{x:\sigma }\tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="false" scriptlevel="0"> <mo stretchy="false">(</mo> <mi>x</mi> <mo>:</mo> <mi>σ<!-- σ --></mi> <mo stretchy="false">)</mo> <mo>×<!-- × --></mo> <mi>τ<!-- τ --></mi> <mo>=</mo> <munder> <mo>∑<!-- ∑ --></mo> <mrow class="MJX-TeXAtom-ORD"> <mi>x</mi> <mo>:</mo> <mi>σ<!-- σ --></mi> </mrow> </munder> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\textstyle (x:\sigma )\times \tau =\sum _{x:\sigma }\tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/8f773dcf7d9ba08678680ac0b961b0f0ba454f28" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -1.005ex; width:20.16ex; height:3.009ex;" alt="{\textstyle (x:\sigma )\times \tau =\sum _{x:\sigma }\tau }"></span>.</span> </li> </ol></div></div> <div class="mw-heading mw-heading3"><h3 id="Dependent_types">Dependent types</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_system&action=edit&section=15" title="Edit section: Dependent types"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1236090951"><div role="note" class="hatnote navigation-not-searchable">Main article: <a href="/wiki/Dependent_type" title="Dependent type">Dependent type</a></div> <p><a href="/wiki/Dependent_type" title="Dependent type">Dependent types</a> are based on the idea of using scalars or values to more precisely describe the type of some other value. For example, <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \mathrm {matrix} (3,3)}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mrow class="MJX-TeXAtom-ORD"> <mi mathvariant="normal">m</mi> <mi mathvariant="normal">a</mi> <mi mathvariant="normal">t</mi> <mi mathvariant="normal">r</mi> <mi mathvariant="normal">i</mi> <mi mathvariant="normal">x</mi> </mrow> <mo stretchy="false">(</mo> <mn>3</mn> <mo>,</mo> <mn>3</mn> <mo stretchy="false">)</mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \mathrm {matrix} (3,3)}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/04b6df3034e02a45990859737da4794e846b8c08" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:11.957ex; height:2.843ex;" alt="{\displaystyle \mathrm {matrix} (3,3)}"></span> might be the type of a <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle 3\times 3}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mn>3</mn> <mo>×<!-- × --></mo> <mn>3</mn> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle 3\times 3}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/ddc0d4d6106875f8006be1d898512ca5843bad8e" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:5.165ex; height:2.176ex;" alt="{\displaystyle 3\times 3}"></span> matrix. We can then define typing rules such as the following rule for matrix multiplication: </p> <dl><dd><span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \mathrm {matrix} _{\mathrm {multiply} }:\mathrm {matrix} (k,m)\times \mathrm {matrix} (m,n)\to \mathrm {matrix} (k,n)}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <msub> <mrow class="MJX-TeXAtom-ORD"> <mi mathvariant="normal">m</mi> <mi mathvariant="normal">a</mi> <mi mathvariant="normal">t</mi> <mi mathvariant="normal">r</mi> <mi mathvariant="normal">i</mi> <mi mathvariant="normal">x</mi> </mrow> <mrow class="MJX-TeXAtom-ORD"> <mrow class="MJX-TeXAtom-ORD"> <mi mathvariant="normal">m</mi> <mi mathvariant="normal">u</mi> <mi mathvariant="normal">l</mi> <mi mathvariant="normal">t</mi> <mi mathvariant="normal">i</mi> <mi mathvariant="normal">p</mi> <mi mathvariant="normal">l</mi> <mi mathvariant="normal">y</mi> </mrow> </mrow> </msub> <mo>:</mo> <mrow class="MJX-TeXAtom-ORD"> <mi mathvariant="normal">m</mi> <mi mathvariant="normal">a</mi> <mi mathvariant="normal">t</mi> <mi mathvariant="normal">r</mi> <mi mathvariant="normal">i</mi> <mi mathvariant="normal">x</mi> </mrow> <mo stretchy="false">(</mo> <mi>k</mi> <mo>,</mo> <mi>m</mi> <mo stretchy="false">)</mo> <mo>×<!-- × --></mo> <mrow class="MJX-TeXAtom-ORD"> <mi mathvariant="normal">m</mi> <mi mathvariant="normal">a</mi> <mi mathvariant="normal">t</mi> <mi mathvariant="normal">r</mi> <mi mathvariant="normal">i</mi> <mi mathvariant="normal">x</mi> </mrow> <mo stretchy="false">(</mo> <mi>m</mi> <mo>,</mo> <mi>n</mi> <mo stretchy="false">)</mo> <mo stretchy="false">→<!-- → --></mo> <mrow class="MJX-TeXAtom-ORD"> <mi mathvariant="normal">m</mi> <mi mathvariant="normal">a</mi> <mi mathvariant="normal">t</mi> <mi mathvariant="normal">r</mi> <mi mathvariant="normal">i</mi> <mi mathvariant="normal">x</mi> </mrow> <mo stretchy="false">(</mo> <mi>k</mi> <mo>,</mo> <mi>n</mi> <mo stretchy="false">)</mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \mathrm {matrix} _{\mathrm {multiply} }:\mathrm {matrix} (k,m)\times \mathrm {matrix} (m,n)\to \mathrm {matrix} (k,n)}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/a9b5ca3ad745c07126727667fefc60055f0549ff" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -1.005ex; width:59.679ex; height:3.009ex;" alt="{\displaystyle \mathrm {matrix} _{\mathrm {multiply} }:\mathrm {matrix} (k,m)\times \mathrm {matrix} (m,n)\to \mathrm {matrix} (k,n)}"></span></dd></dl> <p>where <span class="texhtml mvar" style="font-style:italic;">k</span>, <span class="texhtml mvar" style="font-style:italic;">m</span>, <span class="texhtml mvar" style="font-style:italic;">n</span> are arbitrary positive integer values. A variant of <a href="/wiki/ML_(programming_language)" title="ML (programming language)">ML</a> called <a href="/wiki/Dependent_ML" title="Dependent ML">Dependent ML</a> has been created based on this type system, but because type checking for conventional dependent types is <a href="/wiki/Decidable_set" class="mw-redirect" title="Decidable set">undecidable</a>, not all programs using them can be type-checked without some kind of limits. Dependent ML limits the sort of equality it can decide to <a href="/wiki/Presburger_arithmetic" title="Presburger arithmetic">Presburger arithmetic</a>. </p><p>Other languages such as <a href="/wiki/Epigram_(programming_language)" title="Epigram (programming language)">Epigram</a> make the value of all expressions in the language decidable so that type checking can be decidable. However, in general <a href="/wiki/Halting_Problem" class="mw-redirect" title="Halting Problem">proof of decidability is undecidable</a>, so many programs require hand-written annotations that may be very non-trivial. As this impedes the development process, many language implementations provide an easy way out in the form of an option to disable this condition. This, however, comes at the cost of making the type-checker run in an <a href="/wiki/Infinite_loop" title="Infinite loop">infinite loop</a> when fed programs that do not type-check, causing the compilation to fail. </p> <div class="mw-heading mw-heading3"><h3 id="Linear_types">Linear types</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_system&action=edit&section=16" title="Edit section: Linear types"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1236090951"><div role="note" class="hatnote navigation-not-searchable">Main article: <a href="/wiki/Linear_type" class="mw-redirect" title="Linear type">Linear type</a></div> <p><a href="/wiki/Linear_type" class="mw-redirect" title="Linear type">Linear types</a>, based on the theory of <a href="/wiki/Linear_logic" title="Linear logic">linear logic</a>, and closely related to <a href="/wiki/Uniqueness_type" title="Uniqueness type">uniqueness types</a>, are types assigned to values having the property that they have one and only one reference to them at all times. These are valuable for describing large <a href="/wiki/Immutable_value" class="mw-redirect" title="Immutable value">immutable values</a> such as files, strings, and so on, because any operation that simultaneously destroys a linear object and creates a similar object (such as <code>str = str + "a"</code>) can be optimized "under the hood" into an in-place mutation. Normally this is not possible, as such mutations could cause side effects on parts of the program holding other references to the object, violating <a href="/wiki/Referential_transparency" title="Referential transparency">referential transparency</a>. They are also used in the prototype operating system <a href="/wiki/Singularity_(operating_system)" title="Singularity (operating system)">Singularity</a> for interprocess communication, statically ensuring that processes cannot share objects in shared memory in order to prevent race conditions. The <a href="/wiki/Clean_(programming_language)" title="Clean (programming language)">Clean</a> language (a <a href="/wiki/Haskell_(programming_language)" class="mw-redirect" title="Haskell (programming language)">Haskell</a>-like language) uses this type system in order to gain a lot of speed (compared to performing a deep copy) while remaining safe. </p> <div class="mw-heading mw-heading3"><h3 id="Intersection_types">Intersection types</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_system&action=edit&section=17" title="Edit section: Intersection types"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1236090951"><div role="note" class="hatnote navigation-not-searchable">Main article: <a href="/wiki/Intersection_type" title="Intersection type">Intersection type</a></div> <p><a href="/wiki/Intersection_type" title="Intersection type">Intersection types</a> are types describing values that belong to <i>both</i> of two other given types with overlapping value sets. For example, in most implementations of C the signed char has range -128 to 127 and the unsigned char has range 0 to 255, so the intersection type of these two types would have range 0 to 127. Such an intersection type could be safely passed into functions expecting <i>either</i> signed or unsigned chars, because it is compatible with both types. </p><p>Intersection types are useful for describing overloaded function types: for example, if "<code class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><span class="kt">int</span></code> → <code class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><span class="kt">int</span></code>" is the type of functions taking an integer argument and returning an integer, and "<code class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><span class="kt">float</span></code> → <code class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><span class="kt">float</span></code>" is the type of functions taking a float argument and returning a float, then the intersection of these two types can be used to describe functions that do one or the other, based on what type of input they are given. Such a function could be passed into another function expecting an "<code class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><span class="kt">int</span></code> → <code class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><span class="kt">int</span></code>" function safely; it simply would not use the "<code class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><span class="kt">float</span></code> → <code class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><span class="kt">float</span></code>" functionality. </p><p>In a subclassing hierarchy, the intersection of a type and an ancestor type (such as its parent) is the most derived type. The intersection of sibling types is empty. </p><p>The Forsythe language includes a general implementation of intersection types. A restricted form is <a href="/wiki/Refinement_type" title="Refinement type">refinement types</a>. </p> <div class="mw-heading mw-heading3"><h3 id="Union_types">Union types</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_system&action=edit&section=18" title="Edit section: Union types"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1236090951"><div role="note" class="hatnote navigation-not-searchable">Main article: <a href="/wiki/Union_type" title="Union type">Union type</a></div> <p><a href="/wiki/Union_type" title="Union type">Union types</a> are types describing values that belong to <i>either</i> of two types. For example, in C, the signed char has a -128 to 127 range, and the unsigned char has a 0 to 255 range, so the union of these two types would have an overall "virtual" range of -128 to 255 that may be used partially depending on which union member is accessed. Any function handling this union type would have to deal with integers in this complete range. More generally, the only valid operations on a union type are operations that are valid on <i>both</i> types being unioned. C's "union" concept is similar to union types, but is not typesafe, as it permits operations that are valid on <i>either</i> type, rather than <i>both</i>. Union types are important in program analysis, where they are used to represent symbolic values whose exact nature (e.g., value or type) is not known. </p><p>In a subclassing hierarchy, the union of a type and an ancestor type (such as its parent) is the ancestor type. The union of sibling types is a subtype of their common ancestor (that is, all operations permitted on their common ancestor are permitted on the union type, but they may also have other valid operations in common). </p> <div class="mw-heading mw-heading3"><h3 id="Existential_types">Existential types</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_system&action=edit&section=19" title="Edit section: Existential types"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1236090951"><div role="note" class="hatnote navigation-not-searchable">Main article: <a href="/wiki/Existential_quantifier" class="mw-redirect" title="Existential quantifier">Existential quantifier</a></div> <p><a href="/wiki/Existential_quantifier" class="mw-redirect" title="Existential quantifier">Existential</a> types are frequently used in connection with <a href="/wiki/Record_(computer_science)" title="Record (computer science)">record types</a> to represent <a href="/wiki/Module_(programming)" class="mw-redirect" title="Module (programming)">modules</a> and <a href="/wiki/Abstract_data_type" title="Abstract data type">abstract data types</a>, due to their ability to separate implementation from interface. For example, the type "T = ∃X { a: X; f: (X → int); }" describes a module interface that has a data member named <i>a</i> of type <i>X</i> and a function named <i>f</i> that takes a parameter of the <i>same</i> type <i>X</i> and returns an integer. This could be implemented in different ways; for example: </p> <ul><li>intT = { a: int; f: (int → int); }</li> <li>floatT = { a: float; f: (float → int); }</li></ul> <p>These types are both subtypes of the more general existential type T and correspond to concrete implementation types, so any value of one of these types is a value of type T. Given a value "t" of type "T", we know that "t.f(t.a)" is well-typed, regardless of what the abstract type <i>X</i> is. This gives flexibility for choosing types suited to a particular implementation, while clients that use only values of the interface type—the existential type—are isolated from these choices. </p><p>In general it's impossible for the typechecker to infer which existential type a given module belongs to. In the above example intT { a: int; f: (int → int); } could also have the type ∃X { a: X; f: (int → int); }. The simplest solution is to annotate every module with its intended type, e.g.: </p> <ul><li>intT = { a: int; f: (int → int); } <b>as</b> ∃X { a: X; f: (X → int); }</li></ul> <p>Although abstract data types and modules had been implemented in programming languages for quite some time, it wasn't until 1988 that <a href="/wiki/John_C._Mitchell" title="John C. Mitchell">John C. Mitchell</a> and <a href="/wiki/Gordon_Plotkin" title="Gordon Plotkin">Gordon Plotkin</a> established the formal theory under the slogan: "Abstract [data] types have existential type".<sup id="cite_ref-29" class="reference"><a href="#cite_note-29"><span class="cite-bracket">[</span>25<span class="cite-bracket">]</span></a></sup> The theory is a second-order <a href="/wiki/Typed_lambda_calculus" title="Typed lambda calculus">typed lambda calculus</a> similar to <a href="/wiki/System_F" title="System F">System F</a>, but with existential instead of universal quantification. </p> <div class="mw-heading mw-heading3"><h3 id="Gradual_typing">Gradual typing</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_system&action=edit&section=20" title="Edit section: Gradual typing"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1236090951"><div role="note" class="hatnote navigation-not-searchable">Main article: <a href="/wiki/Gradual_typing" title="Gradual typing">Gradual typing</a></div> <p>In a type system with <a href="/wiki/Gradual_typing" title="Gradual typing">Gradual typing</a>, variables may be assigned a type either at <a href="/wiki/Compile-time" class="mw-redirect" title="Compile-time">compile-time</a> (which is static typing), or at <a href="/wiki/Run_time_(program_lifecycle_phase)" class="mw-redirect" title="Run time (program lifecycle phase)">run-time</a> (which is dynamic typing).<sup id="cite_ref-siek_30-0" class="reference"><a href="#cite_note-siek-30"><span class="cite-bracket">[</span>26<span class="cite-bracket">]</span></a></sup> This allows software developers to choose either type paradigm as appropriate, from within a single language.<sup id="cite_ref-siek_30-1" class="reference"><a href="#cite_note-siek-30"><span class="cite-bracket">[</span>26<span class="cite-bracket">]</span></a></sup> Gradual typing uses a special type named <i>dynamic</i> to represent statically unknown types; gradual typing replaces the notion of type equality with a new relation called <i>consistency</i> that relates the dynamic type to every other type. The consistency relation is symmetric but not transitive.<sup id="cite_ref-siekTaha_31-0" class="reference"><a href="#cite_note-siekTaha-31"><span class="cite-bracket">[</span>27<span class="cite-bracket">]</span></a></sup> </p> <div class="mw-heading mw-heading2"><h2 id="Explicit_or_implicit_declaration_and_inference">Explicit or implicit declaration and inference</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_system&action=edit&section=21" title="Edit section: Explicit or implicit declaration and inference"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1236090951"><div role="note" class="hatnote navigation-not-searchable">Further information: <a href="/wiki/Type_inference" title="Type inference">Type inference</a></div> <p>Many static type systems, such as those of C and Java, require <i>type declarations</i>: the programmer must explicitly associate each variable with a specific type. Others, such as Haskell's, perform <i><a href="/wiki/Type_inference" title="Type inference">type inference</a></i>: the compiler draws conclusions about the types of variables based on how programmers use those variables. For example, given a function <code class="mw-highlight mw-highlight-lang-java mw-content-ltr" dir="ltr"><span class="n">f</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="w"> </span><span class="n">y</span><span class="p">)</span></code> that adds <code class="mw-highlight mw-highlight-lang-java mw-content-ltr" dir="ltr"><span class="n">x</span></code> and <code class="mw-highlight mw-highlight-lang-java mw-content-ltr" dir="ltr"><span class="n">y</span></code> together, the compiler can infer that <code class="mw-highlight mw-highlight-lang-java mw-content-ltr" dir="ltr"><span class="n">x</span></code> and <code class="mw-highlight mw-highlight-lang-java mw-content-ltr" dir="ltr"><span class="n">y</span></code> must be numbers—since addition is only defined for numbers. Thus, any call to <code class="mw-highlight mw-highlight-lang-java mw-content-ltr" dir="ltr"><span class="n">f</span></code> elsewhere in the program that specifies a non-numeric type (such as a string or list) as an argument would signal an error. </p><p>Numerical and string constants and expressions in code can and often do imply type in a particular context. For example, an expression <code class="mw-highlight mw-highlight-lang-java mw-content-ltr" dir="ltr"><span class="mf">3.14</span></code> might imply a type of <a href="/wiki/Floating-point" class="mw-redirect" title="Floating-point">floating-point</a>, while <code class="mw-highlight mw-highlight-lang-java mw-content-ltr" dir="ltr"><span class="o">[</span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w"> </span><span class="mi">3</span><span class="o">]</span></code> might imply a list of integers—typically an <a href="/wiki/Array_data_structure" class="mw-redirect" title="Array data structure">array</a>. </p><p>Type inference is in general possible, if it is <a href="/wiki/Computable_function" title="Computable function">computable</a> in the type system in question. Moreover, even if inference is not computable in general for a given type system, inference is often possible for a large subset of real-world programs. Haskell's type system, a version of <a href="/wiki/Type_inference#Hindley–Milner_type_inference_algorithm" title="Type inference">Hindley–Milner</a>, is a restriction of <a href="/wiki/System_F-omega" class="mw-redirect" title="System F-omega">System Fω</a> to so-called rank-1 polymorphic types, in which type inference is computable. Most Haskell compilers allow arbitrary-rank polymorphism as an extension, but this makes type inference not computable. (Type checking is <a href="/wiki/Decidability_(logic)" title="Decidability (logic)">decidable</a>, however, and rank-1 programs still have type inference; higher rank polymorphic programs are rejected unless given explicit type annotations.) </p> <div class="mw-heading mw-heading2"><h2 id="Decision_problems">Decision problems</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_system&action=edit&section=22" title="Edit section: Decision problems"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1236090951"><div role="note" class="hatnote navigation-not-searchable">Main article: <a href="/wiki/Type_theory#Decision_problems" title="Type theory">Type theory § Decision problems</a></div> <p>A type system that assigns types to terms in type environments using <a href="/wiki/Typing_rule" title="Typing rule">typing rules</a> is naturally associated with the <a href="/wiki/Decision_problem" title="Decision problem">decision problems</a> of <a href="/wiki/Type_checking" class="mw-redirect" title="Type checking">type checking</a>, <a href="/wiki/Typability" class="mw-redirect" title="Typability">typability</a>, and <a href="/wiki/Type_inhabitation" title="Type inhabitation">type inhabitation</a>.<sup id="cite_ref-32" class="reference"><a href="#cite_note-32"><span class="cite-bracket">[</span>28<span class="cite-bracket">]</span></a></sup> </p> <ul><li>Given a type environment <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \Gamma }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi mathvariant="normal">Γ<!-- Γ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \Gamma }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/4cfde86a3f7ec967af9955d0988592f0693d2b19" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:1.453ex; height:2.176ex;" alt="{\displaystyle \Gamma }"></span>, a term <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle e}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>e</mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle e}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/cd253103f0876afc68ebead27a5aa9867d927467" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:1.083ex; height:1.676ex;" alt="{\displaystyle e}"></span>, and a type <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/38a7dcde9730ef0853809fefc18d88771f95206c" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:1.202ex; height:1.676ex;" alt="{\displaystyle \tau }"></span>, decide whether the term <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle e}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>e</mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle e}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/cd253103f0876afc68ebead27a5aa9867d927467" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:1.083ex; height:1.676ex;" alt="{\displaystyle e}"></span> can be assigned the type <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/38a7dcde9730ef0853809fefc18d88771f95206c" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:1.202ex; height:1.676ex;" alt="{\displaystyle \tau }"></span> in the type environment.</li> <li>Given a term <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle e}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>e</mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle e}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/cd253103f0876afc68ebead27a5aa9867d927467" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:1.083ex; height:1.676ex;" alt="{\displaystyle e}"></span>, decide whether there exists a type environment <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \Gamma }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi mathvariant="normal">Γ<!-- Γ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \Gamma }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/4cfde86a3f7ec967af9955d0988592f0693d2b19" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:1.453ex; height:2.176ex;" alt="{\displaystyle \Gamma }"></span> and a type <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/38a7dcde9730ef0853809fefc18d88771f95206c" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:1.202ex; height:1.676ex;" alt="{\displaystyle \tau }"></span> such that the term <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle e}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>e</mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle e}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/cd253103f0876afc68ebead27a5aa9867d927467" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:1.083ex; height:1.676ex;" alt="{\displaystyle e}"></span> can be assigned the type <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/38a7dcde9730ef0853809fefc18d88771f95206c" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:1.202ex; height:1.676ex;" alt="{\displaystyle \tau }"></span> in the type environment <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \Gamma }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi mathvariant="normal">Γ<!-- Γ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \Gamma }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/4cfde86a3f7ec967af9955d0988592f0693d2b19" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:1.453ex; height:2.176ex;" alt="{\displaystyle \Gamma }"></span>.</li> <li>Given a type environment <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \Gamma }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi mathvariant="normal">Γ<!-- Γ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \Gamma }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/4cfde86a3f7ec967af9955d0988592f0693d2b19" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:1.453ex; height:2.176ex;" alt="{\displaystyle \Gamma }"></span> and a type <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/38a7dcde9730ef0853809fefc18d88771f95206c" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:1.202ex; height:1.676ex;" alt="{\displaystyle \tau }"></span>, decide whether there exists a term <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle e}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>e</mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle e}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/cd253103f0876afc68ebead27a5aa9867d927467" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:1.083ex; height:1.676ex;" alt="{\displaystyle e}"></span> that can be assigned the type <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \tau }"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>τ<!-- τ --></mi> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \tau }</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/38a7dcde9730ef0853809fefc18d88771f95206c" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:1.202ex; height:1.676ex;" alt="{\displaystyle \tau }"></span> in the type environment.</li></ul> <div class="mw-heading mw-heading2"><h2 id="Unified_type_system">Unified type system</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_system&action=edit&section=23" title="Edit section: Unified type system"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Some languages like <a href="/wiki/C_Sharp_(programming_language)" title="C Sharp (programming language)">C#</a> or <a href="/wiki/Scala_(programming_language)" title="Scala (programming language)">Scala</a> have a unified type system.<sup id="cite_ref-33" class="reference"><a href="#cite_note-33"><span class="cite-bracket">[</span>29<span class="cite-bracket">]</span></a></sup> This means that all <a href="/wiki/C_Sharp_(programming_language)" title="C Sharp (programming language)">C#</a> types including primitive types inherit from a single root object. Every type in <a href="/wiki/C_Sharp_(programming_language)" title="C Sharp (programming language)">C#</a> inherits from the Object class. Some languages, like <a href="/wiki/Java_(programming_language)" title="Java (programming language)">Java</a> and <a href="/wiki/Raku_(programming_language)" title="Raku (programming language)">Raku</a>, have a root type but also have primitive types that are not objects.<sup id="cite_ref-34" class="reference"><a href="#cite_note-34"><span class="cite-bracket">[</span>30<span class="cite-bracket">]</span></a></sup> Java provides wrapper object types that exist together with the primitive types so developers can use either the wrapper object types or the simpler non-object primitive types. Raku automatically converts primitive types to objects when their methods are accessed.<sup id="cite_ref-35" class="reference"><a href="#cite_note-35"><span class="cite-bracket">[</span>31<span class="cite-bracket">]</span></a></sup> </p> <div class="mw-heading mw-heading2"><h2 id="Compatibility:_equivalence_and_subtyping">Compatibility: equivalence and subtyping</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_system&action=edit&section=24" title="Edit section: Compatibility: equivalence and subtyping"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>A type checker for a statically typed language must verify that the type of any <a href="/wiki/Expression_(programming)" class="mw-redirect" title="Expression (programming)">expression</a> is consistent with the type expected by the context in which that expression appears. For example, in an <a href="/wiki/Assignment_statement" class="mw-redirect" title="Assignment statement">assignment statement</a> of the form <code>x := <i>e</i></code>, the inferred type of the expression <i><code>e</code></i> must be consistent with the declared or inferred type of the variable <code>x</code>. This notion of consistency, called <i>compatibility</i>, is specific to each programming language. </p><p>If the type of <i><code>e</code></i> and the type of <code>x</code> are the same, and assignment is allowed for that type, then this is a valid expression. Thus, in the simplest type systems, the question of whether two types are compatible reduces to that of whether they are <i>equal</i> (or <i>equivalent</i>). Different languages, however, have different criteria for when two type expressions are understood to denote the same type. These different <i>equational theories</i> of types vary widely, two extreme cases being <i><a href="/wiki/Structural_type_system" title="Structural type system">structural type systems</a></i>, in which any two types that describe values with the same structure are equivalent, and <i><a href="/wiki/Nominative_type_system" class="mw-redirect" title="Nominative type system">nominative type systems</a></i>, in which no two syntactically distinct type expressions denote the same type (<i>i.e.</i>, types must have the same "name" in order to be equal). </p><p>In languages with <a href="/wiki/Subtyping" title="Subtyping">subtyping</a>, the compatibility relation is more complex: If <code>B</code> is a subtype of <code>A</code>, then a value of type <code>B</code> can be used in a context where one of type <code>A</code> is expected (<a href="/wiki/Covariance_and_contravariance_(computer_science)" title="Covariance and contravariance (computer science)">covariant</a>), even if the reverse is not true. Like equivalence, the subtype relation is defined differently for each programming language, with many variations possible. The presence of parametric or <a href="/wiki/Ad_hoc_polymorphism" title="Ad hoc polymorphism">ad hoc polymorphism</a> in a language may also have implications for type compatibility. </p> <div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_system&action=edit&section=25" title="Edit section: See also"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <style data-mw-deduplicate="TemplateStyles:r1266661725">.mw-parser-output .portalbox{padding:0;margin:0.5em 0;display:table;box-sizing:border-box;max-width:175px;list-style:none}.mw-parser-output .portalborder{border:1px solid var(--border-color-base,#a2a9b1);padding:0.1em;background:var(--background-color-neutral-subtle,#f8f9fa)}.mw-parser-output .portalbox-entry{display:table-row;font-size:85%;line-height:110%;height:1.9em;font-style:italic;font-weight:bold}.mw-parser-output .portalbox-image{display:table-cell;padding:0.2em;vertical-align:middle;text-align:center}.mw-parser-output .portalbox-link{display:table-cell;padding:0.2em 0.2em 0.2em 0.3em;vertical-align:middle}@media(min-width:720px){.mw-parser-output .portalleft{margin:0.5em 1em 0.5em 0}.mw-parser-output .portalright{clear:right;float:right;margin:0.5em 0 0.5em 1em}}</style><ul role="navigation" aria-label="Portals" class="noprint portalbox portalborder portalright"> <li class="portalbox-entry"><span class="portalbox-image"><span class="noviewer" typeof="mw:File"><a href="/wiki/File:Octicons-terminal.svg" class="mw-file-description"><img alt="icon" src="//upload.wikimedia.org/wikipedia/commons/thumb/6/6f/Octicons-terminal.svg/24px-Octicons-terminal.svg.png" decoding="async" width="24" height="28" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/6/6f/Octicons-terminal.svg/37px-Octicons-terminal.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/6/6f/Octicons-terminal.svg/49px-Octicons-terminal.svg.png 2x" data-file-width="896" data-file-height="1024" /></a></span></span><span class="portalbox-link"><a href="/wiki/Portal:Computer_programming" title="Portal:Computer programming">Computer programming portal</a></span></li></ul> <ul><li><a href="/wiki/Comparison_of_type_systems" class="mw-redirect" title="Comparison of type systems">Comparison of type systems</a></li> <li><a href="/wiki/Covariance_and_contravariance_(computer_science)" title="Covariance and contravariance (computer science)">Covariance and contravariance (computer science)</a></li> <li><a href="/wiki/Polymorphism_in_object-oriented_programming" class="mw-redirect" title="Polymorphism in object-oriented programming">Polymorphism in object-oriented programming</a></li> <li><a href="/wiki/Type_signature" title="Type signature">Type signature</a></li> <li><a href="/wiki/Type_theory" title="Type theory">Type theory</a></li></ul> <div class="mw-heading mw-heading2"><h2 id="Notes">Notes</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_system&action=edit&section=26" title="Edit section: Notes"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1239543626"><div class="reflist"> <div class="mw-references-wrap"><ol class="references"> <li id="cite_note-Burroughs-4"><span class="mw-cite-backlink"><b><a href="#cite_ref-Burroughs_4-0">^</a></b></span> <span class="reference-text">The <a href="/wiki/Burroughs_B6x00-7x00_instruction_set" title="Burroughs B6x00-7x00 instruction set">Burroughs ALGOL computer</a> line determined a memory location's contents by its flag bits. Flag bits specify the contents of a memory location. Instruction, data type, and functions are specified by a 3 bit code in addition to its 48 bit contents. Only the MCP (Master Control Program) could write to the flag code bits.</span> </li> <li id="cite_note-leakyCondition-8"><span class="mw-cite-backlink"><b><a href="#cite_ref-leakyCondition_8-0">^</a></b></span> <span class="reference-text">For example, a <a href="/wiki/Leaky_abstraction" title="Leaky abstraction">leaky abstraction</a> might surface during development, which may show that more type development is needed. —"The evaluation of a well-typed program always terminates".—B. Nordström, K. Petersson, and J. M. Smith<sup id="cite_ref-hlcs_6-0" class="reference"><a href="#cite_note-hlcs-6"><span class="cite-bracket">[</span>5<span class="cite-bracket">]</span></a></sup> <a href="/wiki/SECD_machine#Landin's_contribution" title="SECD machine">A systematic change in variables to avoid capture of a free variable can introduce error</a>, in a functional programming language where functions are first class citizens.<sup id="cite_ref-tfp12_7-0" class="reference"><a href="#cite_note-tfp12-7"><span class="cite-bracket">[</span>6<span class="cite-bracket">]</span></a></sup> —From the <a href="/wiki/Lambda_calculus" title="Lambda calculus">lambda calculus</a> article.</span> </li> </ol></div></div> <div class="mw-heading mw-heading2"><h2 id="References">References</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_system&action=edit&section=27" title="Edit section: References"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1239543626"><div class="reflist reflist-columns references-column-width" style="column-width: 30em;"> <ol class="references"> <li id="cite_note-FOOTNOTEPierce20021-1"><span class="mw-cite-backlink"><b><a href="#cite_ref-FOOTNOTEPierce20021_1-0">^</a></b></span> <span class="reference-text"><a href="#CITEREFPierce2002">Pierce 2002</a>, p. 1: "A type system is a tractable syntactic method for proving the absence of certain program behaviors by classifying phrases according to the kinds of values they compute."</span> </li> <li id="cite_note-FOOTNOTECardelli20041-2"><span class="mw-cite-backlink"><b><a href="#cite_ref-FOOTNOTECardelli20041_2-0">^</a></b></span> <span class="reference-text"><a href="#CITEREFCardelli2004">Cardelli 2004</a>, p. 1: "The fundamental purpose of a type system is to prevent the occurrence of execution errors during the running of a program."</span> </li> <li id="cite_note-FOOTNOTEPierce2002208-3"><span class="mw-cite-backlink"><b><a href="#cite_ref-FOOTNOTEPierce2002208_3-0">^</a></b></span> <span class="reference-text"><a href="#CITEREFPierce2002">Pierce 2002</a>, p. 208.</span> </li> <li id="cite_note-Sethi1997-5"><span class="mw-cite-backlink">^ <a href="#cite_ref-Sethi1997_5-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-Sethi1997_5-1"><sup><i><b>b</b></i></sup></a></span> <span class="reference-text"><style data-mw-deduplicate="TemplateStyles:r1238218222">.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("//upload.wikimedia.org/wikipedia/commons/6/65/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("//upload.wikimedia.org/wikipedia/commons/d/d6/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("//upload.wikimedia.org/wikipedia/commons/a/aa/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("//upload.wikimedia.org/wikipedia/commons/4/4c/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#d33)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#d33)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}</style><cite id="CITEREFSethi1996" class="citation book cs1">Sethi, R. (1996). <i>Programming languages: Concepts and constructs</i> (2nd ed.). Addison-Wesley. p. 142. <a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <a href="/wiki/Special:BookSources/978-0-201-59065-4" title="Special:BookSources/978-0-201-59065-4"><bdi>978-0-201-59065-4</bdi></a>. <a href="/wiki/OCLC_(identifier)" class="mw-redirect" title="OCLC (identifier)">OCLC</a> <a rel="nofollow" class="external text" href="https://search.worldcat.org/oclc/604732680">604732680</a>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=Programming+languages%3A+Concepts+and+constructs&rft.pages=142&rft.edition=2nd&rft.pub=Addison-Wesley&rft.date=1996&rft_id=info%3Aoclcnum%2F604732680&rft.isbn=978-0-201-59065-4&rft.aulast=Sethi&rft.aufirst=R.&rfr_id=info%3Asid%2Fen.wikipedia.org%3AType+system" class="Z3988"></span></span> </li> <li id="cite_note-hlcs-6"><span class="mw-cite-backlink"><b><a href="#cite_ref-hlcs_6-0">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFNordströmPeterssonSmith2001" class="citation book cs1">Nordström, B.; Petersson, K.; Smith, J.M. (2001). <a rel="nofollow" class="external text" href="https://books.google.com/books?id=wRRREAAAQBAJ&pg=PA2">"Martin-Löf's Type Theory"</a>. <i>Algebraic and Logical Structures</i>. Handbook of Logic in Computer Science. Vol. 5. Oxford University Press. p. 2. <a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <a href="/wiki/Special:BookSources/978-0-19-154627-3" title="Special:BookSources/978-0-19-154627-3"><bdi>978-0-19-154627-3</bdi></a>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=bookitem&rft.atitle=Martin-L%C3%B6f%27s+Type+Theory&rft.btitle=Algebraic+and+Logical+Structures&rft.series=Handbook+of+Logic+in+Computer+Science&rft.pages=2&rft.pub=Oxford+University+Press&rft.date=2001&rft.isbn=978-0-19-154627-3&rft.aulast=Nordstr%C3%B6m&rft.aufirst=B.&rft.au=Petersson%2C+K.&rft.au=Smith%2C+J.M.&rft_id=https%3A%2F%2Fbooks.google.com%2Fbooks%3Fid%3DwRRREAAAQBAJ%26pg%3DPA2&rfr_id=info%3Asid%2Fen.wikipedia.org%3AType+system" class="Z3988"></span></span> </li> <li id="cite_note-tfp12-7"><span class="mw-cite-backlink"><b><a href="#cite_ref-tfp12_7-0">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFTurner2012" class="citation web cs1">Turner, D.A. (12 June 2012). <a rel="nofollow" class="external text" href="https://www.cs.kent.ac.uk/people/staff/dat/tfp12/tfp12.pdf">"Some History of Functional Programming Languages"</a> <span class="cs1-format">(PDF)</span>. <i>invited lecture at TFP12, at St Andrews University</i>. See the section on Algol 60.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=unknown&rft.jtitle=invited+lecture+at+TFP12%2C+at+St+Andrews+University&rft.atitle=Some+History+of+Functional+Programming+Languages&rft.pages=See+the+section+on+Algol+60&rft.date=2012-06-12&rft.aulast=Turner&rft.aufirst=D.A.&rft_id=https%3A%2F%2Fwww.cs.kent.ac.uk%2Fpeople%2Fstaff%2Fdat%2Ftfp12%2Ftfp12.pdf&rfr_id=info%3Asid%2Fen.wikipedia.org%3AType+system" class="Z3988"></span></span> </li> <li id="cite_note-9"><span class="mw-cite-backlink"><b><a href="#cite_ref-9">^</a></b></span> <span class="reference-text">"... any sound, decidable type system must be incomplete" —D. Remy (2017). p. 29, <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFRemy" class="citation web cs1">Remy, Didier. <a rel="nofollow" class="external text" href="https://web.archive.org/web/20171114202221/http://gallium.inria.fr/~remy/mpri/cours1.pdf">"Type systems for programming languages"</a> <span class="cs1-format">(PDF)</span>. Archived from <a rel="nofollow" class="external text" href="http://gallium.inria.fr/~remy/mpri/cours1.pdf">the original</a> <span class="cs1-format">(PDF)</span> on 14 November 2017<span class="reference-accessdate">. Retrieved <span class="nowrap">26 May</span> 2013</span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=Type+systems+for+programming+languages&rft.aulast=Remy&rft.aufirst=Didier&rft_id=http%3A%2F%2Fgallium.inria.fr%2F~remy%2Fmpri%2Fcours1.pdf&rfr_id=info%3Asid%2Fen.wikipedia.org%3AType+system" class="Z3988"></span></span> </li> <li id="cite_note-FOOTNOTEPierce2002-10"><span class="mw-cite-backlink"><b><a href="#cite_ref-FOOTNOTEPierce2002_10-0">^</a></b></span> <span class="reference-text"><a href="#CITEREFPierce2002">Pierce 2002</a>.</span> </li> <li id="cite_note-Skeet-11"><span class="mw-cite-backlink">^ <a href="#cite_ref-Skeet_11-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-Skeet_11-1"><sup><i><b>b</b></i></sup></a> <a href="#cite_ref-Skeet_11-2"><sup><i><b>c</b></i></sup></a></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFSkeet2019" class="citation book cs1">Skeet, Jon (2019). <i>C# in Depth</i> (4 ed.). Manning. <a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <a href="/wiki/Special:BookSources/978-1617294532" title="Special:BookSources/978-1617294532"><bdi>978-1617294532</bdi></a>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=C%23+in+Depth&rft.edition=4&rft.pub=Manning&rft.date=2019&rft.isbn=978-1617294532&rft.aulast=Skeet&rft.aufirst=Jon&rfr_id=info%3Asid%2Fen.wikipedia.org%3AType+system" class="Z3988"></span></span> </li> <li id="cite_note-12"><span class="mw-cite-backlink"><b><a href="#cite_ref-12">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFMiglani2018" class="citation web cs1">Miglani, Gaurav (2018). <a rel="nofollow" class="external text" href="https://www.geeksforgeeks.org/dynamic-method-dispatch-runtime-polymorphism-java/">"Dynamic Method Dispatch or Runtime Polymorphism in Java"</a>. <a rel="nofollow" class="external text" href="https://web.archive.org/web/20201207174217/https://www.geeksforgeeks.org/dynamic-method-dispatch-runtime-polymorphism-java/">Archived</a> from the original on 2020-12-07<span class="reference-accessdate">. Retrieved <span class="nowrap">2021-03-28</span></span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=Dynamic+Method+Dispatch+or+Runtime+Polymorphism+in+Java&rft.date=2018&rft.aulast=Miglani&rft.aufirst=Gaurav&rft_id=https%3A%2F%2Fwww.geeksforgeeks.org%2Fdynamic-method-dispatch-runtime-polymorphism-java%2F&rfr_id=info%3Asid%2Fen.wikipedia.org%3AType+system" class="Z3988"></span></span> </li> <li id="cite_note-13"><span class="mw-cite-backlink"><b><a href="#cite_ref-13">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFWright1995" class="citation thesis cs1">Wright, Andrew K. (1995). <a rel="nofollow" class="external text" href="https://dl.acm.org/doi/10.5555/269586"><i>Practical Soft Typing</i></a> (PhD). Rice University. <a href="/wiki/Hdl_(identifier)" class="mw-redirect" title="Hdl (identifier)">hdl</a>:<a rel="nofollow" class="external text" href="https://hdl.handle.net/1911%2F16900">1911/16900</a>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Adissertation&rft.title=Practical+Soft+Typing&rft.inst=Rice+University&rft.date=1995&rft_id=info%3Ahdl%2F1911%2F16900&rft.aulast=Wright&rft.aufirst=Andrew+K.&rft_id=https%3A%2F%2Fdl.acm.org%2Fdoi%2F10.5555%2F269586&rfr_id=info%3Asid%2Fen.wikipedia.org%3AType+system" class="Z3988"></span></span> </li> <li id="cite_note-14"><span class="mw-cite-backlink"><b><a href="#cite_ref-14">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://msdn.microsoft.com/en-us/library/dd264741.aspx">"dynamic (C# Reference)"</a>. <i><a href="/wiki/MSDN_Library" class="mw-redirect" title="MSDN Library">MSDN Library</a></i>. Microsoft<span class="reference-accessdate">. Retrieved <span class="nowrap">14 January</span> 2014</span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=unknown&rft.jtitle=MSDN+Library&rft.atitle=dynamic+%28C%23+Reference%29&rft_id=http%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2Fdd264741.aspx&rfr_id=info%3Asid%2Fen.wikipedia.org%3AType+system" class="Z3988"></span></span> </li> <li id="cite_note-15"><span class="mw-cite-backlink"><b><a href="#cite_ref-15">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://doc.rust-lang.org/std/any/index.html">"std::any — Rust"</a>. <i>doc.rust-lang.org</i><span class="reference-accessdate">. Retrieved <span class="nowrap">2021-07-07</span></span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=unknown&rft.jtitle=doc.rust-lang.org&rft.atitle=std%3A%3Aany+%E2%80%94+Rust&rft_id=https%3A%2F%2Fdoc.rust-lang.org%2Fstd%2Fany%2Findex.html&rfr_id=info%3Asid%2Fen.wikipedia.org%3AType+system" class="Z3988"></span></span> </li> <li id="cite_note-16"><span class="mw-cite-backlink"><b><a href="#cite_ref-16">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFMeijerDrayton" class="citation web cs1">Meijer, Erik; Drayton, Peter. <a rel="nofollow" class="external text" href="http://research.microsoft.com/en-us/um/people/emeijer/Papers/RDL04Meijer.pdf">"Static Typing Where Possible, Dynamic Typing When Needed: The End of the Cold War Between Programming Languages"</a> <span class="cs1-format">(PDF)</span>. <a href="/wiki/Microsoft" title="Microsoft">Microsoft</a> Corporation.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=Static+Typing+Where+Possible%2C+Dynamic+Typing+When+Needed%3A+The+End+of+the+Cold+War+Between+Programming+Languages&rft.pub=Microsoft+Corporation&rft.aulast=Meijer&rft.aufirst=Erik&rft.au=Drayton%2C+Peter&rft_id=http%3A%2F%2Fresearch.microsoft.com%2Fen-us%2Fum%2Fpeople%2Femeijer%2FPapers%2FRDL04Meijer.pdf&rfr_id=info%3Asid%2Fen.wikipedia.org%3AType+system" class="Z3988"></span></span> </li> <li id="cite_note-17"><span class="mw-cite-backlink"><b><a href="#cite_ref-17">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFLaucherSnively2012" class="citation web cs1">Laucher, Amanda; Snively, Paul (2012). <a rel="nofollow" class="external text" href="http://www.infoq.com/presentations/Types-Tests">"Types vs Tests"</a>. InfoQ.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=Types+vs+Tests&rft.pub=InfoQ&rft.date=2012&rft.aulast=Laucher&rft.aufirst=Amanda&rft.au=Snively%2C+Paul&rft_id=http%3A%2F%2Fwww.infoq.com%2Fpresentations%2FTypes-Tests&rfr_id=info%3Asid%2Fen.wikipedia.org%3AType+system" class="Z3988"></span></span> </li> <li id="cite_note-18"><span class="mw-cite-backlink"><b><a href="#cite_ref-18">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFXi1998" class="citation thesis cs1">Xi, Hongwei (1998). <i>Dependent Types in Practical Programming</i> (PhD). Department of Mathematical Sciences, Carnegie Mellon University. <a href="/wiki/CiteSeerX_(identifier)" class="mw-redirect" title="CiteSeerX (identifier)">CiteSeerX</a> <span class="id-lock-free" title="Freely accessible"><a rel="nofollow" class="external text" href="https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.41.548">10.1.1.41.548</a></span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Adissertation&rft.title=Dependent+Types+in+Practical+Programming&rft.inst=Department+of+Mathematical+Sciences%2C+Carnegie+Mellon+University&rft.date=1998&rft_id=https%3A%2F%2Fciteseerx.ist.psu.edu%2Fviewdoc%2Fsummary%3Fdoi%3D10.1.1.41.548%23id-name%3DCiteSeerX&rft.aulast=Xi&rft.aufirst=Hongwei&rfr_id=info%3Asid%2Fen.wikipedia.org%3AType+system" class="Z3988"></span><br /><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFXiPfenning1999" class="citation book cs1">Xi, Hongwei; Pfenning, Frank (1999). "Dependent Types in Practical Programming". <i>Proceedings of the 26th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages</i>. ACM. pp. <span class="nowrap">214–</span>227. <a href="/wiki/CiteSeerX_(identifier)" class="mw-redirect" title="CiteSeerX (identifier)">CiteSeerX</a> <span class="id-lock-free" title="Freely accessible"><a rel="nofollow" class="external text" href="https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.69.2042">10.1.1.69.2042</a></span>. <a href="/wiki/Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<a rel="nofollow" class="external text" href="https://doi.org/10.1145%2F292540.292560">10.1145/292540.292560</a>. <a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <a href="/wiki/Special:BookSources/1581130953" title="Special:BookSources/1581130953"><bdi>1581130953</bdi></a>. <a href="/wiki/S2CID_(identifier)" class="mw-redirect" title="S2CID (identifier)">S2CID</a> <a rel="nofollow" class="external text" href="https://api.semanticscholar.org/CorpusID:245490">245490</a>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=bookitem&rft.atitle=Dependent+Types+in+Practical+Programming&rft.btitle=Proceedings+of+the+26th+ACM+SIGPLAN-SIGACT+Symposium+on+Principles+of+Programming+Languages&rft.pages=%3Cspan+class%3D%22nowrap%22%3E214-%3C%2Fspan%3E227&rft.pub=ACM&rft.date=1999&rft_id=https%3A%2F%2Fciteseerx.ist.psu.edu%2Fviewdoc%2Fsummary%3Fdoi%3D10.1.1.69.2042%23id-name%3DCiteSeerX&rft_id=https%3A%2F%2Fapi.semanticscholar.org%2FCorpusID%3A245490%23id-name%3DS2CID&rft_id=info%3Adoi%2F10.1145%2F292540.292560&rft.isbn=1581130953&rft.aulast=Xi&rft.aufirst=Hongwei&rft.au=Pfenning%2C+Frank&rfr_id=info%3Asid%2Fen.wikipedia.org%3AType+system" class="Z3988"></span></span> </li> <li id="cite_note-19"><span class="mw-cite-backlink"><b><a href="#cite_ref-19">^</a></b></span> <span class="reference-text"><a href="/wiki/Visual_Basic" title="Visual Basic">Visual Basic</a> is an example of a language that is both type-safe and memory-safe.</span> </li> <li id="cite_note-20"><span class="mw-cite-backlink"><b><a href="#cite_ref-20">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation book cs1"><a rel="nofollow" class="external text" href="http://www.ecma-international.org/ecma-262/11.0/index.html#sec-strict-variant-of-ecmascript">"4.2.2 The Strict Variant of ECMAScript"</a>. <a rel="nofollow" class="external text" href="http://www.ecma-international.org/publications/standards/Ecma-262.htm"><i>ECMAScript® 2020 Language Specification</i></a> (11th ed.). ECMA. June 2020. ECMA-262.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=bookitem&rft.atitle=4.2.2+The+Strict+Variant+of+ECMAScript&rft.btitle=ECMAScript%C2%AE+2020+Language+Specification&rft.edition=11th&rft.pub=ECMA&rft.date=2020-06&rft_id=http%3A%2F%2Fwww.ecma-international.org%2Fecma-262%2F11.0%2Findex.html%23sec-strict-variant-of-ecmascript&rfr_id=info%3Asid%2Fen.wikipedia.org%3AType+system" class="Z3988"></span></span> </li> <li id="cite_note-21"><span class="mw-cite-backlink"><b><a href="#cite_ref-21">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Functions_and_function_scope/Strict_mode">"Strict mode – JavaScript"</a>. <i>MDN</i>. Developer.mozilla.org. 2013-07-03<span class="reference-accessdate">. Retrieved <span class="nowrap">2013-07-17</span></span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=unknown&rft.jtitle=MDN&rft.atitle=Strict+mode+%E2%80%93+JavaScript&rft.date=2013-07-03&rft_id=https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FJavaScript%2FReference%2FFunctions_and_function_scope%2FStrict_mode&rfr_id=info%3Asid%2Fen.wikipedia.org%3AType+system" class="Z3988"></span></span> </li> <li id="cite_note-22"><span class="mw-cite-backlink"><b><a href="#cite_ref-22">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://msdn.microsoft.com/en-us/library/ie/br230269(v=vs.94).aspx">"Strict Mode (JavaScript)"</a>. <i>MSDN</i>. Microsoft<span class="reference-accessdate">. Retrieved <span class="nowrap">2013-07-17</span></span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=unknown&rft.jtitle=MSDN&rft.atitle=Strict+Mode+%28JavaScript%29&rft_id=http%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2Fie%2Fbr230269%28v%3Dvs.94%29.aspx&rfr_id=info%3Asid%2Fen.wikipedia.org%3AType+system" class="Z3988"></span></span> </li> <li id="cite_note-23"><span class="mw-cite-backlink"><b><a href="#cite_ref-23">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://php.net/manual/en/functions.arguments.php#functions.arguments.type-declaration.strict">"Strict typing"</a>. <i>PHP Manual: Language Reference: Functions</i>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=unknown&rft.jtitle=PHP+Manual%3A+Language+Reference%3A+Functions&rft.atitle=Strict+typing&rft_id=http%3A%2F%2Fphp.net%2Fmanual%2Fen%2Ffunctions.arguments.php%23functions.arguments.type-declaration.strict&rfr_id=info%3Asid%2Fen.wikipedia.org%3AType+system" class="Z3988"></span></span> </li> <li id="cite_note-Bracha-24"><span class="mw-cite-backlink">^ <a href="#cite_ref-Bracha_24-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-Bracha_24-1"><sup><i><b>b</b></i></sup></a></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFBracha" class="citation web cs1">Bracha, G. <a rel="nofollow" class="external text" href="http://bracha.org/pluggableTypesPosition.pdf">"Pluggable Types"</a> <span class="cs1-format">(PDF)</span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=Pluggable+Types&rft.aulast=Bracha&rft.aufirst=G.&rft_id=http%3A%2F%2Fbracha.org%2FpluggableTypesPosition.pdf&rfr_id=info%3Asid%2Fen.wikipedia.org%3AType+system" class="Z3988"></span></span> </li> <li id="cite_note-25"><span class="mw-cite-backlink"><b><a href="#cite_ref-25">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://stackoverflow.com/questions/13399960/is-there-a-language-that-allows-both-static-and-dynamic-typing/13414347#13414347">"Sure. It's called "gradual typing", and I would qualify it as trendy. ..."</a> <i>Is there a language that allows both static and dynamic typing?</i>. stackoverflow. 2012.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=unknown&rft.jtitle=Is+there+a+language+that+allows+both+static+and+dynamic+typing%3F&rft.atitle=Sure.+It%27s+called+%22gradual+typing%22%2C+and+I+would+qualify+it+as+trendy.+...&rft.date=2012&rft_id=https%3A%2F%2Fstackoverflow.com%2Fquestions%2F13399960%2Fis-there-a-language-that-allows-both-static-and-dynamic-typing%2F13414347%2313414347&rfr_id=info%3Asid%2Fen.wikipedia.org%3AType+system" class="Z3988"></span></span> </li> <li id="cite_note-K03-28"><span class="mw-cite-backlink">^ <a href="#cite_ref-K03_28-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-K03_28-1"><sup><i><b>b</b></i></sup></a> <a href="#cite_ref-K03_28-2"><sup><i><b>c</b></i></sup></a></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFKopylov2003" class="citation conference cs1">Kopylov, Alexei (2003). "Dependent intersection: A new way of defining records in type theory". <i>18th IEEE Symposium on Logic in Computer Science</i>. LICS 2003. IEEE Computer Society. pp. <span class="nowrap">86–</span>95. <a href="/wiki/CiteSeerX_(identifier)" class="mw-redirect" title="CiteSeerX (identifier)">CiteSeerX</a> <span class="id-lock-free" title="Freely accessible"><a rel="nofollow" class="external text" href="https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.89.4223">10.1.1.89.4223</a></span>. <a href="/wiki/Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<a rel="nofollow" class="external text" href="https://doi.org/10.1109%2FLICS.2003.1210048">10.1109/LICS.2003.1210048</a>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=conference&rft.atitle=Dependent+intersection%3A+A+new+way+of+defining+records+in+type+theory&rft.btitle=18th+IEEE+Symposium+on+Logic+in+Computer+Science&rft.pages=%3Cspan+class%3D%22nowrap%22%3E86-%3C%2Fspan%3E95&rft.pub=IEEE+Computer+Society&rft.date=2003&rft_id=https%3A%2F%2Fciteseerx.ist.psu.edu%2Fviewdoc%2Fsummary%3Fdoi%3D10.1.1.89.4223%23id-name%3DCiteSeerX&rft_id=info%3Adoi%2F10.1109%2FLICS.2003.1210048&rft.aulast=Kopylov&rft.aufirst=Alexei&rfr_id=info%3Asid%2Fen.wikipedia.org%3AType+system" class="Z3988"></span></span> </li> <li id="cite_note-29"><span class="mw-cite-backlink"><b><a href="#cite_ref-29">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFMitchellPlotkin1988" class="citation journal cs1">Mitchell, John C.; Plotkin, Gordon D. (July 1988). <a rel="nofollow" class="external text" href="http://theory.stanford.edu/~jcm/papers/mitch-plotkin-88.pdf">"Abstract Types Have Existential Type"</a> <span class="cs1-format">(PDF)</span>. <i>ACM Trans. Program. Lang. Syst</i>. <b>10</b> (3): <span class="nowrap">470–</span>502. <a href="/wiki/Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<a rel="nofollow" class="external text" href="https://doi.org/10.1145%2F44501.45065">10.1145/44501.45065</a>. <a href="/wiki/S2CID_(identifier)" class="mw-redirect" title="S2CID (identifier)">S2CID</a> <a rel="nofollow" class="external text" href="https://api.semanticscholar.org/CorpusID:1222153">1222153</a>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=article&rft.jtitle=ACM+Trans.+Program.+Lang.+Syst.&rft.atitle=Abstract+Types+Have+Existential+Type&rft.volume=10&rft.issue=3&rft.pages=%3Cspan+class%3D%22nowrap%22%3E470-%3C%2Fspan%3E502&rft.date=1988-07&rft_id=info%3Adoi%2F10.1145%2F44501.45065&rft_id=https%3A%2F%2Fapi.semanticscholar.org%2FCorpusID%3A1222153%23id-name%3DS2CID&rft.aulast=Mitchell&rft.aufirst=John+C.&rft.au=Plotkin%2C+Gordon+D.&rft_id=http%3A%2F%2Ftheory.stanford.edu%2F~jcm%2Fpapers%2Fmitch-plotkin-88.pdf&rfr_id=info%3Asid%2Fen.wikipedia.org%3AType+system" class="Z3988"></span></span> </li> <li id="cite_note-siek-30"><span class="mw-cite-backlink">^ <a href="#cite_ref-siek_30-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-siek_30-1"><sup><i><b>b</b></i></sup></a></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFSiek2014" class="citation web cs1">Siek, Jeremy (24 March 2014). <a rel="nofollow" class="external text" href="http://homes.soic.indiana.edu/jsiek/what-is-gradual-typing/">"What is gradual typing?"</a>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=What+is+gradual+typing%3F&rft.date=2014-03-24&rft.aulast=Siek&rft.aufirst=Jeremy&rft_id=http%3A%2F%2Fhomes.soic.indiana.edu%2Fjsiek%2Fwhat-is-gradual-typing%2F&rfr_id=info%3Asid%2Fen.wikipedia.org%3AType+system" class="Z3988"></span></span> </li> <li id="cite_note-siekTaha-31"><span class="mw-cite-backlink"><b><a href="#cite_ref-siekTaha_31-0">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFSiekTaha2006" class="citation conference cs1">Siek, Jeremy; Taha, Walid (September 2006). <a rel="nofollow" class="external text" href="http://scheme2006.cs.uchicago.edu/13-siek.pdf"><i>Gradual Typing for Functional Languages</i></a> <span class="cs1-format">(PDF)</span>. <i>Scheme and Functional Programming 2006</i>. <a href="/wiki/University_of_Chicago" title="University of Chicago">University of Chicago</a>. pp. <span class="nowrap">81–</span>92.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=conference&rft.jtitle=Scheme+and+Functional+Programming+2006&rft.atitle=Gradual+Typing+for+Functional+Languages&rft.pages=%3Cspan+class%3D%22nowrap%22%3E81-%3C%2Fspan%3E92&rft.date=2006-09&rft.aulast=Siek&rft.aufirst=Jeremy&rft.au=Taha%2C+Walid&rft_id=http%3A%2F%2Fscheme2006.cs.uchicago.edu%2F13-siek.pdf&rfr_id=info%3Asid%2Fen.wikipedia.org%3AType+system" class="Z3988"></span></span> </li> <li id="cite_note-32"><span class="mw-cite-backlink"><b><a href="#cite_ref-32">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFBarendregtDekkersStatman2013" class="citation book cs1">Barendregt, Henk; Dekkers, Wil; Statman, Richard (20 June 2013). <a rel="nofollow" class="external text" href="https://books.google.com/books?id=2UVasvrhXl8C"><i>Lambda Calculus with Types</i></a>. Cambridge University Press. p. 66. <a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <a href="/wiki/Special:BookSources/978-0-521-76614-2" title="Special:BookSources/978-0-521-76614-2"><bdi>978-0-521-76614-2</bdi></a>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=Lambda+Calculus+with+Types&rft.pages=66&rft.pub=Cambridge+University+Press&rft.date=2013-06-20&rft.isbn=978-0-521-76614-2&rft.aulast=Barendregt&rft.aufirst=Henk&rft.au=Dekkers%2C+Wil&rft.au=Statman%2C+Richard&rft_id=https%3A%2F%2Fbooks.google.com%2Fbooks%3Fid%3D2UVasvrhXl8C&rfr_id=info%3Asid%2Fen.wikipedia.org%3AType+system" class="Z3988"></span></span> </li> <li id="cite_note-33"><span class="mw-cite-backlink"><b><a href="#cite_ref-33">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation book cs1">"8.2.4 Type system unification". <a rel="nofollow" class="external text" href="http://www.ecma-international.org/publications/standards/Ecma-334.htm"><i>C# Language Specification</i></a> (5th ed.). ECMA. December 2017. ECMA-334.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=bookitem&rft.atitle=8.2.4+Type+system+unification&rft.btitle=C%23+Language+Specification&rft.edition=5th&rft.pub=ECMA&rft.date=2017-12&rft_id=http%3A%2F%2Fwww.ecma-international.org%2Fpublications%2Fstandards%2FEcma-334.htm&rfr_id=info%3Asid%2Fen.wikipedia.org%3AType+system" class="Z3988"></span></span> </li> <li id="cite_note-34"><span class="mw-cite-backlink"><b><a href="#cite_ref-34">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://docs.perl6.org/language/nativetypes">"Native Types"</a>. <i>Perl 6 Documentation</i>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=unknown&rft.jtitle=Perl+6+Documentation&rft.atitle=Native+Types&rft_id=https%3A%2F%2Fdocs.perl6.org%2Flanguage%2Fnativetypes&rfr_id=info%3Asid%2Fen.wikipedia.org%3AType+system" class="Z3988"></span></span> </li> <li id="cite_note-35"><span class="mw-cite-backlink"><b><a href="#cite_ref-35">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://docs.perl6.org/language/numerics#Auto-boxing">"Numerics, § Auto-boxing"</a>. <i>Perl 6 Documentation</i>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=unknown&rft.jtitle=Perl+6+Documentation&rft.atitle=Numerics%2C+%C2%A7+Auto-boxing&rft_id=https%3A%2F%2Fdocs.perl6.org%2Flanguage%2Fnumerics%23Auto-boxing&rfr_id=info%3Asid%2Fen.wikipedia.org%3AType+system" class="Z3988"></span></span> </li> </ol></div> <div class="mw-heading mw-heading2"><h2 id="Further_reading">Further reading</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_system&action=edit&section=28" title="Edit section: Further reading"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <ul><li><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFCardelliWegner1985" class="citation journal cs1"><a href="/wiki/Luca_Cardelli" title="Luca Cardelli">Cardelli, Luca</a>; <a href="/wiki/Peter_Wegner_(computer_scientist)" title="Peter Wegner (computer scientist)">Wegner, Peter</a> (December 1985). <a rel="nofollow" class="external text" href="http://lucacardelli.name/Papers/OnUnderstanding.A4.pdf">"On Understanding Types, Data Abstraction, and Polymorphism"</a> <span class="cs1-format">(PDF)</span>. <i><a href="/wiki/ACM_Computing_Surveys" title="ACM Computing Surveys">ACM Computing Surveys</a></i>. <b>17</b> (4): <span class="nowrap">471–</span>523. <a href="/wiki/CiteSeerX_(identifier)" class="mw-redirect" title="CiteSeerX (identifier)">CiteSeerX</a> <span class="id-lock-free" title="Freely accessible"><a rel="nofollow" class="external text" href="https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.117.695">10.1.1.117.695</a></span>. <a href="/wiki/Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<a rel="nofollow" class="external text" href="https://doi.org/10.1145%2F6041.6042">10.1145/6041.6042</a>. <a href="/wiki/S2CID_(identifier)" class="mw-redirect" title="S2CID (identifier)">S2CID</a> <a rel="nofollow" class="external text" href="https://api.semanticscholar.org/CorpusID:2921816">2921816</a>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=article&rft.jtitle=ACM+Computing+Surveys&rft.atitle=On+Understanding+Types%2C+Data+Abstraction%2C+and+Polymorphism&rft.volume=17&rft.issue=4&rft.pages=%3Cspan+class%3D%22nowrap%22%3E471-%3C%2Fspan%3E523&rft.date=1985-12&rft_id=https%3A%2F%2Fciteseerx.ist.psu.edu%2Fviewdoc%2Fsummary%3Fdoi%3D10.1.1.117.695%23id-name%3DCiteSeerX&rft_id=https%3A%2F%2Fapi.semanticscholar.org%2FCorpusID%3A2921816%23id-name%3DS2CID&rft_id=info%3Adoi%2F10.1145%2F6041.6042&rft.aulast=Cardelli&rft.aufirst=Luca&rft.au=Wegner%2C+Peter&rft_id=http%3A%2F%2Flucacardelli.name%2FPapers%2FOnUnderstanding.A4.pdf&rfr_id=info%3Asid%2Fen.wikipedia.org%3AType+system" class="Z3988"></span></li> <li><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFPierce2002" class="citation book cs1"><a href="/wiki/Benjamin_C._Pierce" title="Benjamin C. Pierce">Pierce, Benjamin C.</a> (2002). <i>Types and Programming Languages</i>. MIT Press. <a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <a href="/wiki/Special:BookSources/978-0-262-16209-8" title="Special:BookSources/978-0-262-16209-8"><bdi>978-0-262-16209-8</bdi></a>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=Types+and+Programming+Languages&rft.pub=MIT+Press&rft.date=2002&rft.isbn=978-0-262-16209-8&rft.aulast=Pierce&rft.aufirst=Benjamin+C.&rfr_id=info%3Asid%2Fen.wikipedia.org%3AType+system" class="Z3988"></span></li> <li><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFCardelli2004" class="citation book cs1"><a href="/wiki/Luca_Cardelli" title="Luca Cardelli">Cardelli, Luca</a> (2004). <a rel="nofollow" class="external text" href="http://lucacardelli.name/Papers/TypeSystems.pdf">"Type systems"</a> <span class="cs1-format">(PDF)</span>. In Allen B. Tucker (ed.). <i>CRC Handbook of Computer Science and Engineering</i> (2nd ed.). CRC Press. <a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <a href="/wiki/Special:BookSources/978-1584883609" title="Special:BookSources/978-1584883609"><bdi>978-1584883609</bdi></a>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=bookitem&rft.atitle=Type+systems&rft.btitle=CRC+Handbook+of+Computer+Science+and+Engineering&rft.edition=2nd&rft.pub=CRC+Press&rft.date=2004&rft.isbn=978-1584883609&rft.aulast=Cardelli&rft.aufirst=Luca&rft_id=http%3A%2F%2Flucacardelli.name%2FPapers%2FTypeSystems.pdf&rfr_id=info%3Asid%2Fen.wikipedia.org%3AType+system" class="Z3988"></span></li> <li><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFTratt2009" class="citation book cs1">Tratt, Laurence (July 2009). <a rel="nofollow" class="external text" href="https://tratt.net/laurie/research/publications/html/tratt__dynamically_typed_languages/">"5. Dynamically Typed Languages"</a>. <i>Advances in Computers</i>. Vol. 77. Elsevier. pp. <span class="nowrap">149–</span>184. <a href="/wiki/Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<a rel="nofollow" class="external text" href="https://doi.org/10.1016%2FS0065-2458%2809%2901205-4">10.1016/S0065-2458(09)01205-4</a>. <a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <a href="/wiki/Special:BookSources/978-0-12-374812-6" title="Special:BookSources/978-0-12-374812-6"><bdi>978-0-12-374812-6</bdi></a>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=bookitem&rft.atitle=5.+Dynamically+Typed+Languages&rft.btitle=Advances+in+Computers&rft.pages=%3Cspan+class%3D%22nowrap%22%3E149-%3C%2Fspan%3E184&rft.pub=Elsevier&rft.date=2009-07&rft_id=info%3Adoi%2F10.1016%2FS0065-2458%2809%2901205-4&rft.isbn=978-0-12-374812-6&rft.aulast=Tratt&rft.aufirst=Laurence&rft_id=http%3A%2F%2Ftratt.net%2Flaurie%2Fresearch%2Fpublications%2Fhtml%2Ftratt__dynamically_typed_languages%2F&rfr_id=info%3Asid%2Fen.wikipedia.org%3AType+system" class="Z3988"></span></li></ul> <div class="mw-heading mw-heading2"><h2 id="External_links">External links</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Type_system&action=edit&section=29" title="Edit section: External links"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <style data-mw-deduplicate="TemplateStyles:r1235681985">.mw-parser-output .side-box{margin:4px 0;box-sizing:border-box;border:1px solid #aaa;font-size:88%;line-height:1.25em;background-color:var(--background-color-interactive-subtle,#f8f9fa);display:flow-root}.mw-parser-output .side-box-abovebelow,.mw-parser-output .side-box-text{padding:0.25em 0.9em}.mw-parser-output .side-box-image{padding:2px 0 2px 0.9em;text-align:center}.mw-parser-output .side-box-imageright{padding:2px 0.9em 2px 0;text-align:center}@media(min-width:500px){.mw-parser-output .side-box-flex{display:flex;align-items:center}.mw-parser-output .side-box-text{flex:1;min-width:0}}@media(min-width:720px){.mw-parser-output .side-box{width:238px}.mw-parser-output .side-box-right{clear:right;float:right;margin-left:1em}.mw-parser-output .side-box-left{margin-right:1em}}</style><style data-mw-deduplicate="TemplateStyles:r1237033735">@media print{body.ns-0 .mw-parser-output .sistersitebox{display:none!important}}@media screen{html.skin-theme-clientpref-night .mw-parser-output .sistersitebox img[src*="Wiktionary-logo-en-v2.svg"]{background-color:white}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .sistersitebox img[src*="Wiktionary-logo-en-v2.svg"]{background-color:white}}</style><div class="side-box side-box-right plainlinks sistersitebox"><style data-mw-deduplicate="TemplateStyles:r1126788409">.mw-parser-output .plainlist ol,.mw-parser-output .plainlist ul{line-height:inherit;list-style:none;margin:0;padding:0}.mw-parser-output .plainlist ol li,.mw-parser-output .plainlist ul li{margin-bottom:0}</style> <div class="side-box-flex"> <div class="side-box-image"><span class="noviewer" typeof="mw:File"><a href="/wiki/File:Wikibooks-logo-en-noslogan.svg" class="mw-file-description"><img alt="" src="//upload.wikimedia.org/wikipedia/commons/thumb/d/df/Wikibooks-logo-en-noslogan.svg/40px-Wikibooks-logo-en-noslogan.svg.png" decoding="async" width="40" height="40" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/d/df/Wikibooks-logo-en-noslogan.svg/60px-Wikibooks-logo-en-noslogan.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/d/df/Wikibooks-logo-en-noslogan.svg/80px-Wikibooks-logo-en-noslogan.svg.png 2x" data-file-width="400" data-file-height="400" /></a></span></div> <div class="side-box-text plainlist">The Wikibook <i><a href="https://en.wikibooks.org/wiki/Ada_Programming" class="extiw" title="wikibooks:Ada Programming">Ada Programming</a></i> has a page on the topic of: <i><b><a href="https://en.wikibooks.org/wiki/Ada_Programming/Types" class="extiw" title="wikibooks:Ada Programming/Types">Types</a></b></i></div></div> </div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1235681985"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1237033735"><div class="side-box side-box-right plainlinks sistersitebox"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1126788409"> <div class="side-box-flex"> <div class="side-box-image"><span class="noviewer" typeof="mw:File"><a href="/wiki/File:Wikibooks-logo-en-noslogan.svg" class="mw-file-description"><img alt="" src="//upload.wikimedia.org/wikipedia/commons/thumb/d/df/Wikibooks-logo-en-noslogan.svg/40px-Wikibooks-logo-en-noslogan.svg.png" decoding="async" width="40" height="40" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/d/df/Wikibooks-logo-en-noslogan.svg/60px-Wikibooks-logo-en-noslogan.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/d/df/Wikibooks-logo-en-noslogan.svg/80px-Wikibooks-logo-en-noslogan.svg.png 2x" data-file-width="400" data-file-height="400" /></a></span></div> <div class="side-box-text plainlist">The Wikibook <i><a href="https://en.wikibooks.org/wiki/Haskell" class="extiw" title="wikibooks:Haskell">Haskell</a></i> has a page on the topic of: <i><b><a href="https://en.wikibooks.org/wiki/Haskell/Class_declarations" class="extiw" title="wikibooks:Haskell/Class declarations">Class declarations</a></b></i></div></div> </div> <ul><li><span class="noviewer" typeof="mw:File"><a href="/wiki/File:Commons-logo.svg" class="mw-file-description"><img alt="" src="//upload.wikimedia.org/wikipedia/en/thumb/4/4a/Commons-logo.svg/12px-Commons-logo.svg.png" decoding="async" width="12" height="16" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/en/thumb/4/4a/Commons-logo.svg/18px-Commons-logo.svg.png 1.5x, //upload.wikimedia.org/wikipedia/en/thumb/4/4a/Commons-logo.svg/24px-Commons-logo.svg.png 2x" data-file-width="1024" data-file-height="1376" /></a></span> Media related to <a href="https://commons.wikimedia.org/wiki/Category:Type_systems" class="extiw" title="commons:Category:Type systems">Type systems</a> at Wikimedia Commons</li> <li><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFSmith2011" class="citation web cs1">Smith, Chris (2011). <a rel="nofollow" class="external text" href="http://cdsmith.wordpress.com/2011/01/09/an-old-article-i-wrote/">"What to Know Before Debating Type Systems"</a>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=What+to+Know+Before+Debating+Type+Systems&rft.date=2011&rft.aulast=Smith&rft.aufirst=Chris&rft_id=http%3A%2F%2Fcdsmith.wordpress.com%2F2011%2F01%2F09%2Fan-old-article-i-wrote%2F&rfr_id=info%3Asid%2Fen.wikipedia.org%3AType+system" class="Z3988"></span></li></ul> <div class="navbox-styles"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1129693374"><style data-mw-deduplicate="TemplateStyles:r1236075235">.mw-parser-output .navbox{box-sizing:border-box;border:1px solid #a2a9b1;width:100%;clear:both;font-size:88%;text-align:center;padding:1px;margin:1em auto 0}.mw-parser-output .navbox .navbox{margin-top:0}.mw-parser-output .navbox+.navbox,.mw-parser-output .navbox+.navbox-styles+.navbox{margin-top:-1px}.mw-parser-output .navbox-inner,.mw-parser-output .navbox-subgroup{width:100%}.mw-parser-output .navbox-group,.mw-parser-output .navbox-title,.mw-parser-output .navbox-abovebelow{padding:0.25em 1em;line-height:1.5em;text-align:center}.mw-parser-output .navbox-group{white-space:nowrap;text-align:right}.mw-parser-output .navbox,.mw-parser-output .navbox-subgroup{background-color:#fdfdfd}.mw-parser-output .navbox-list{line-height:1.5em;border-color:#fdfdfd}.mw-parser-output .navbox-list-with-group{text-align:left;border-left-width:2px;border-left-style:solid}.mw-parser-output tr+tr>.navbox-abovebelow,.mw-parser-output tr+tr>.navbox-group,.mw-parser-output tr+tr>.navbox-image,.mw-parser-output tr+tr>.navbox-list{border-top:2px solid #fdfdfd}.mw-parser-output .navbox-title{background-color:#ccf}.mw-parser-output .navbox-abovebelow,.mw-parser-output .navbox-group,.mw-parser-output .navbox-subgroup .navbox-title{background-color:#ddf}.mw-parser-output .navbox-subgroup .navbox-group,.mw-parser-output .navbox-subgroup .navbox-abovebelow{background-color:#e6e6ff}.mw-parser-output .navbox-even{background-color:#f7f7f7}.mw-parser-output .navbox-odd{background-color:transparent}.mw-parser-output .navbox .hlist td dl,.mw-parser-output .navbox .hlist td ol,.mw-parser-output .navbox .hlist td ul,.mw-parser-output .navbox td.hlist dl,.mw-parser-output .navbox td.hlist ol,.mw-parser-output .navbox td.hlist ul{padding:0.125em 0}.mw-parser-output .navbox .navbar{display:block;font-size:100%}.mw-parser-output .navbox-title .navbar{float:left;text-align:left;margin-right:0.5em}body.skin--responsive .mw-parser-output .navbox-image img{max-width:none!important}@media print{body.ns-0 .mw-parser-output .navbox{display:none!important}}</style></div><div role="navigation" class="navbox" aria-labelledby="Data_types177" style="padding:3px"><table class="nowraplinks hlist mw-collapsible autocollapse navbox-inner" style="border-spacing:0;background:transparent;color:inherit"><tbody><tr><th scope="col" class="navbox-title" colspan="2"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1129693374"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1239400231"><div class="navbar plainlinks hlist navbar-mini"><ul><li class="nv-view"><a href="/wiki/Template:Data_types" title="Template:Data types"><abbr title="View this template">v</abbr></a></li><li class="nv-talk"><a href="/wiki/Template_talk:Data_types" title="Template talk:Data types"><abbr title="Discuss this template">t</abbr></a></li><li class="nv-edit"><a href="/wiki/Special:EditPage/Template:Data_types" title="Special:EditPage/Template:Data types"><abbr title="Edit this template">e</abbr></a></li></ul></div><div id="Data_types177" style="font-size:114%;margin:0 4em"><a href="/wiki/Data_type" title="Data type">Data types</a></div></th></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="/wiki/Units_of_information" title="Units of information">Uninterpreted</a></th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em"> <ul><li><a href="/wiki/Bit" title="Bit">Bit</a></li> <li><a href="/wiki/Byte" title="Byte">Byte</a></li> <li><a href="/wiki/Ternary_numeral_system" title="Ternary numeral system">Trit</a></li> <li><a href="/wiki/Ternary_numeral_system#Tryte" title="Ternary numeral system">Tryte</a></li> <li><a href="/wiki/Word_(computer_architecture)" title="Word (computer architecture)">Word</a></li> <li><a href="/wiki/Bit_array" title="Bit array">Bit array</a></li></ul> </div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">Numeric</th><td class="navbox-list-with-group navbox-list navbox-even" style="width:100%;padding:0"><div style="padding:0 0.25em"> <ul><li><a href="/wiki/Arbitrary-precision_arithmetic" title="Arbitrary-precision arithmetic">Arbitrary-precision or bignum</a></li> <li><a href="/wiki/Complex_data_type" title="Complex data type">Complex</a></li> <li><a href="/wiki/Decimal_data_type" title="Decimal data type">Decimal</a></li> <li><a href="/wiki/Fixed-point_arithmetic" title="Fixed-point arithmetic">Fixed point</a></li> <li><a href="/wiki/Floating-point_arithmetic" title="Floating-point arithmetic">Floating point</a> <ul><li>Reduced precision <ul><li><a href="/wiki/Minifloat" title="Minifloat">Minifloat</a></li> <li><a href="/wiki/Half-precision_floating-point_format" title="Half-precision floating-point format">Half precision</a></li> <li><a href="/wiki/Bfloat16_floating-point_format" title="Bfloat16 floating-point format">bfloat16</a></li></ul></li> <li><a href="/wiki/Single-precision_floating-point_format" title="Single-precision floating-point format">Single precision</a></li> <li><a href="/wiki/Double-precision_floating-point_format" title="Double-precision floating-point format">Double precision</a></li> <li><a href="/wiki/Quadruple-precision_floating-point_format" title="Quadruple-precision floating-point format">Quadruple precision</a></li> <li><a href="/wiki/Octuple-precision_floating-point_format" title="Octuple-precision floating-point format">Octuple precision</a></li> <li><a href="/wiki/Extended_precision" title="Extended precision">Extended precision</a> <ul><li><a href="/wiki/Long_double" title="Long double">Long double</a></li></ul></li></ul></li> <li><a href="/wiki/Integer_(computer_science)" title="Integer (computer science)">Integer</a> <ul><li><a href="/wiki/Signedness" title="Signedness">signedness</a></li></ul></li> <li><a href="/wiki/Interval_arithmetic#Implementations" title="Interval arithmetic">Interval</a></li> <li><a href="/wiki/Rational_data_type" title="Rational data type">Rational</a></li></ul> </div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="/wiki/Pointer_(computer_programming)" title="Pointer (computer programming)">Pointer</a></th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em"> <ul><li><a href="/wiki/Memory_address" title="Memory address">Address</a> <ul><li><a href="/wiki/Physical_address" title="Physical address">physical</a></li> <li><a href="/wiki/Virtual_address_space" title="Virtual address space">virtual</a></li></ul></li> <li><a href="/wiki/Reference_(computer_science)" title="Reference (computer science)">Reference</a></li></ul> </div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="/wiki/Plain_text" title="Plain text">Text</a></th><td class="navbox-list-with-group navbox-list navbox-even" style="width:100%;padding:0"><div style="padding:0 0.25em"> <ul><li><a href="/wiki/Character_(computing)" title="Character (computing)">Character</a></li> <li><a href="/wiki/String_(computer_science)" title="String (computer science)">String</a> <ul><li><a href="/wiki/Null-terminated_string" title="Null-terminated string">null-terminated</a></li></ul></li></ul> </div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="/wiki/Composite_data_type" title="Composite data type">Composite</a></th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em"> <ul><li><a href="/wiki/Algebraic_data_type" title="Algebraic data type">Algebraic data type</a> <ul><li><a href="/wiki/Generalized_algebraic_data_type" title="Generalized algebraic data type">generalized</a></li></ul></li> <li><a href="/wiki/Array_data_type" class="mw-redirect" title="Array data type">Array</a></li> <li><a href="/wiki/Associative_array" title="Associative array">Associative array</a></li> <li><a href="/wiki/Class_(computer_programming)" title="Class (computer programming)">Class</a></li> <li><a href="/wiki/Dependent_type" title="Dependent type">Dependent</a></li> <li><a href="/wiki/Intuitionistic_type_theory#Equality_type" title="Intuitionistic type theory">Equality</a></li> <li><a href="/wiki/Inductive_type" title="Inductive type">Inductive</a></li> <li><a href="/wiki/Intersection_type" title="Intersection type">Intersection</a></li> <li><a href="/wiki/List_(abstract_data_type)" title="List (abstract data type)">List</a></li> <li><a href="/wiki/Object_(computer_science)" title="Object (computer science)">Object</a> <ul><li><a href="/wiki/Metaobject" title="Metaobject">metaobject</a></li></ul></li> <li><a href="/wiki/Option_type" title="Option type">Option type</a></li> <li><a href="/wiki/Product_type" title="Product type">Product</a></li> <li><a href="/wiki/Record_(computer_science)" title="Record (computer science)">Record or Struct</a></li> <li><a href="/wiki/Refinement_type" title="Refinement type">Refinement</a></li> <li><a href="/wiki/Set_(abstract_data_type)" title="Set (abstract data type)">Set</a></li> <li><a href="/wiki/Union_type" title="Union type">Union</a> <ul><li><a href="/wiki/Tagged_union" title="Tagged union">tagged</a></li></ul></li></ul> </div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">Other</th><td class="navbox-list-with-group navbox-list navbox-even" style="width:100%;padding:0"><div style="padding:0 0.25em"> <ul><li><a href="/wiki/Boolean_data_type" title="Boolean data type">Boolean</a></li> <li><a href="/wiki/Bottom_type" title="Bottom type">Bottom type</a></li> <li><a href="/wiki/Container_(abstract_data_type)" title="Container (abstract data type)">Collection</a></li> <li><a href="/wiki/Enumerated_type" title="Enumerated type">Enumerated type</a></li> <li><a href="/wiki/Exception_handling" title="Exception handling">Exception</a></li> <li><a href="/wiki/Function_type" title="Function type">Function type</a></li> <li><a href="/wiki/Opaque_data_type" title="Opaque data type">Opaque data type</a></li> <li><a href="/wiki/Recursive_data_type" title="Recursive data type">Recursive data type</a></li> <li><a href="/wiki/Semaphore_(programming)" title="Semaphore (programming)">Semaphore</a></li> <li><a href="/wiki/Stream_(computing)" title="Stream (computing)">Stream</a></li> <li><a href="/wiki/Strongly_typed_identifier" title="Strongly typed identifier">Strongly typed identifier</a></li> <li><a href="/wiki/Top_type" title="Top type">Top type</a></li> <li><a href="/wiki/Type_class" title="Type class">Type class</a></li> <li><a href="/wiki/Empty_type" title="Empty type">Empty type</a></li> <li><a href="/wiki/Unit_type" title="Unit type">Unit type</a></li> <li><a href="/wiki/Void_type" title="Void type">Void</a></li></ul> </div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">Related<br />topics</th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em"> <ul><li><a href="/wiki/Abstract_data_type" title="Abstract data type">Abstract data type</a></li> <li><a href="/wiki/Boxing_(computer_science)" class="mw-redirect" title="Boxing (computer science)">Boxing</a></li> <li><a href="/wiki/Data_structure" title="Data structure">Data structure</a></li> <li><a href="/wiki/Generic_programming" title="Generic programming">Generic</a></li> <li><a href="/wiki/Kind_(type_theory)" title="Kind (type theory)">Kind</a> <ul><li><a href="/wiki/Metaclass" title="Metaclass">metaclass</a></li></ul></li> <li><a href="/wiki/Parametric_polymorphism" title="Parametric polymorphism">Parametric polymorphism</a></li> <li><a href="/wiki/Primitive_data_type" title="Primitive data type">Primitive data type</a></li> <li><a href="/wiki/Interface_(object-oriented_programming)" title="Interface (object-oriented programming)">Interface</a></li> <li><a href="/wiki/Subtyping" title="Subtyping">Subtyping</a></li> <li><a href="/wiki/Type_constructor" title="Type constructor">Type constructor</a></li> <li><a href="/wiki/Type_conversion" title="Type conversion">Type conversion</a></li> <li><a class="mw-selflink selflink">Type system</a></li> <li><a href="/wiki/Type_theory" title="Type theory">Type theory</a></li> <li><a href="/wiki/Variable_(computer_science)" title="Variable (computer science)">Variable</a></li></ul> </div></td></tr></tbody></table></div> <!-- NewPP limit report Parsed by mw‐web.codfw.main‐65b64b4b74‐kczqg Cached time: 20250219122752 Cache expiry: 2592000 Reduced expiry: false Complications: [vary‐revision‐sha1, show‐toc] CPU time usage: 0.759 seconds Real time usage: 1.049 seconds Preprocessor visited node count: 6294/1000000 Post‐expand include size: 123635/2097152 bytes Template argument size: 7918/2097152 bytes Highest expansion depth: 16/100 Expensive parser function count: 49/500 Unstrip recursion depth: 1/20 Unstrip post‐expand size: 150849/5000000 bytes Lua time usage: 0.421/10.000 seconds Lua memory usage: 9412200/52428800 bytes Number of Wikibase entities loaded: 1/400 --> <!-- Transclusion expansion time report (%,ms,calls,template) 100.00% 789.888 1 -total 26.25% 207.322 3 Template:Reflist 14.28% 112.804 10 Template:Cite_book 9.30% 73.499 1 Template:Type_systems 9.11% 71.968 1 Template:Sidebar 7.57% 59.756 1 Template:Short_description 7.15% 56.460 16 Template:Cite_web 6.70% 52.937 4 Template:Sfn 5.97% 47.134 1 Template:Commonscatinline 5.59% 44.170 1 Template:More_footnotes --> <!-- Saved in parser cache with key enwiki:pcache:199701:|#|:idhash:canonical and timestamp 20250219122752 and revision id 1274970460. Rendering was triggered because: page-view --> </div><!--esi <esi:include src="/esitest-fa8a495983347898/content" /> --><noscript><img src="https://login.wikimedia.org/wiki/Special:CentralAutoLogin/start?useformat=desktop&type=1x1&usesul3=0" alt="" width="1" height="1" style="border: none; position: absolute;"></noscript> <div class="printfooter" data-nosnippet="">Retrieved from "<a dir="ltr" href="https://en.wikipedia.org/w/index.php?title=Type_system&oldid=1274970460#Dynamic_type_checking_and_runtime_type_information">https://en.wikipedia.org/w/index.php?title=Type_system&oldid=1274970460#Dynamic_type_checking_and_runtime_type_information</a>"</div></div> <div id="catlinks" class="catlinks" data-mw="interface"><div id="mw-normal-catlinks" class="mw-normal-catlinks"><a href="/wiki/Help:Category" title="Help:Category">Categories</a>: <ul><li><a href="/wiki/Category:Type_systems" title="Category:Type systems">Type systems</a></li><li><a href="/wiki/Category:Data_types" title="Category:Data types">Data types</a></li><li><a href="/wiki/Category:Program_analysis" title="Category:Program analysis">Program analysis</a></li><li><a href="/wiki/Category:Type_theory" title="Category:Type theory">Type theory</a></li></ul></div><div id="mw-hidden-catlinks" class="mw-hidden-catlinks mw-hidden-cats-hidden">Hidden categories: <ul><li><a href="/wiki/Category:Articles_with_short_description" title="Category:Articles with short description">Articles with short description</a></li><li><a href="/wiki/Category:Short_description_is_different_from_Wikidata" title="Category:Short description is different from Wikidata">Short description is different from Wikidata</a></li><li><a href="/wiki/Category:Articles_lacking_in-text_citations_from_October_2010" title="Category:Articles lacking in-text citations from October 2010">Articles lacking in-text citations from October 2010</a></li><li><a href="/wiki/Category:All_articles_lacking_in-text_citations" title="Category:All articles lacking in-text citations">All articles lacking in-text citations</a></li><li><a href="/wiki/Category:Wikipedia_articles_with_style_issues_from_July_2016" title="Category:Wikipedia articles with style issues from July 2016">Wikipedia articles with style issues from July 2016</a></li><li><a href="/wiki/Category:All_articles_with_style_issues" title="Category:All articles with style issues">All articles with style issues</a></li><li><a href="/wiki/Category:All_articles_with_specifically_marked_weasel-worded_phrases" title="Category:All articles with specifically marked weasel-worded phrases">All articles with specifically marked weasel-worded phrases</a></li><li><a href="/wiki/Category:Articles_with_specifically_marked_weasel-worded_phrases_from_July_2017" title="Category:Articles with specifically marked weasel-worded phrases from July 2017">Articles with specifically marked weasel-worded phrases from July 2017</a></li><li><a href="/wiki/Category:Articles_with_specifically_marked_weasel-worded_phrases_from_November_2015" title="Category:Articles with specifically marked weasel-worded phrases from November 2015">Articles with specifically marked weasel-worded phrases from November 2015</a></li><li><a href="/wiki/Category:All_articles_with_unsourced_statements" title="Category:All articles with unsourced statements">All articles with unsourced statements</a></li><li><a href="/wiki/Category:Articles_with_unsourced_statements_from_November_2015" title="Category:Articles with unsourced statements from November 2015">Articles with unsourced statements from November 2015</a></li><li><a href="/wiki/Category:Wikipedia_articles_needing_clarification_from_November_2015" title="Category:Wikipedia articles needing clarification from November 2015">Wikipedia articles needing clarification from November 2015</a></li><li><a href="/wiki/Category:Articles_needing_more_detailed_references" title="Category:Articles needing more detailed references">Articles needing more detailed references</a></li><li><a href="/wiki/Category:Articles_with_example_C_code" title="Category:Articles with example C code">Articles with example C code</a></li><li><a href="/wiki/Category:Articles_with_example_Java_code" title="Category:Articles with example Java code">Articles with example Java code</a></li><li><a href="/wiki/Category:Commons_category_link_is_on_Wikidata" title="Category:Commons category link is on Wikidata">Commons category link is on Wikidata</a></li></ul></div></div> </div> </main> </div> <div class="mw-footer-container"> <footer id="footer" class="mw-footer" > <ul id="footer-info"> <li id="footer-info-lastmod"> This page was last edited on 10 February 2025, at 09:33<span class="anonymous-show"> (UTC)</span>.</li> <li id="footer-info-copyright">Text is available under the <a href="/wiki/Wikipedia:Text_of_the_Creative_Commons_Attribution-ShareAlike_4.0_International_License" title="Wikipedia:Text of the Creative Commons Attribution-ShareAlike 4.0 International License">Creative Commons Attribution-ShareAlike 4.0 License</a>; additional terms may apply. By using this site, you agree to the <a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Terms_of_Use" class="extiw" title="foundation:Special:MyLanguage/Policy:Terms of Use">Terms of Use</a> and <a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy" class="extiw" title="foundation:Special:MyLanguage/Policy:Privacy policy">Privacy Policy</a>. Wikipedia® is a registered trademark of the <a rel="nofollow" class="external text" href="https://wikimediafoundation.org/">Wikimedia Foundation, Inc.</a>, a non-profit organization.</li> </ul> <ul id="footer-places"> <li id="footer-places-privacy"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy">Privacy policy</a></li> <li id="footer-places-about"><a href="/wiki/Wikipedia:About">About Wikipedia</a></li> <li id="footer-places-disclaimers"><a href="/wiki/Wikipedia:General_disclaimer">Disclaimers</a></li> <li id="footer-places-contact"><a href="//en.wikipedia.org/wiki/Wikipedia:Contact_us">Contact Wikipedia</a></li> <li id="footer-places-wm-codeofconduct"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Universal_Code_of_Conduct">Code of Conduct</a></li> <li id="footer-places-developers"><a href="https://developer.wikimedia.org">Developers</a></li> <li id="footer-places-statslink"><a href="https://stats.wikimedia.org/#/en.wikipedia.org">Statistics</a></li> <li id="footer-places-cookiestatement"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Cookie_statement">Cookie statement</a></li> <li id="footer-places-mobileview"><a href="//en.m.wikipedia.org/w/index.php?title=Type_system&mobileaction=toggle_view_mobile#Dynamic_type_checking_and_runtime_type_information" class="noprint stopMobileRedirectToggle">Mobile view</a></li> </ul> <ul id="footer-icons" class="noprint"> <li id="footer-copyrightico"><a href="https://wikimediafoundation.org/" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><picture><source media="(min-width: 500px)" srcset="/static/images/footer/wikimedia-button.svg" width="84" height="29"><img src="/static/images/footer/wikimedia.svg" width="25" height="25" alt="Wikimedia Foundation" lang="en" loading="lazy"></picture></a></li> <li id="footer-poweredbyico"><a href="https://www.mediawiki.org/" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><picture><source media="(min-width: 500px)" srcset="/w/resources/assets/poweredby_mediawiki.svg" width="88" height="31"><img src="/w/resources/assets/mediawiki_compact.svg" alt="Powered by MediaWiki" width="25" height="25" loading="lazy"></picture></a></li> </ul> </footer> </div> </div> </div> <div class="vector-header-container vector-sticky-header-container"> <div id="vector-sticky-header" class="vector-sticky-header"> <div class="vector-sticky-header-start"> <div class="vector-sticky-header-icon-start vector-button-flush-left vector-button-flush-right" aria-hidden="true"> <button class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-sticky-header-search-toggle" tabindex="-1" data-event-name="ui.vector-sticky-search-form.icon"><span class="vector-icon mw-ui-icon-search mw-ui-icon-wikimedia-search"></span> <span>Search</span> </button> </div> <div role="search" class="vector-search-box-vue vector-search-box-show-thumbnail vector-search-box"> <div class="vector-typeahead-search-container"> <div class="cdx-typeahead-search cdx-typeahead-search--show-thumbnail"> <form action="/w/index.php" id="vector-sticky-search-form" class="cdx-search-input cdx-search-input--has-end-button"> <div class="cdx-search-input__input-wrapper" data-search-loc="header-moved"> <div class="cdx-text-input cdx-text-input--has-start-icon"> <input class="cdx-text-input__input" type="search" name="search" placeholder="Search Wikipedia"> <span class="cdx-text-input__icon cdx-text-input__start-icon"></span> </div> <input type="hidden" name="title" value="Special:Search"> </div> <button class="cdx-button cdx-search-input__end-button">Search</button> </form> </div> </div> </div> <div class="vector-sticky-header-context-bar"> <nav aria-label="Contents" class="vector-toc-landmark"> <div id="vector-sticky-header-toc" class="vector-dropdown mw-portlet mw-portlet-sticky-header-toc vector-sticky-header-toc vector-button-flush-left" > <input type="checkbox" id="vector-sticky-header-toc-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-sticky-header-toc" class="vector-dropdown-checkbox " aria-label="Toggle the table of contents" > <label id="vector-sticky-header-toc-label" for="vector-sticky-header-toc-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-listBullet mw-ui-icon-wikimedia-listBullet"></span> <span class="vector-dropdown-label-text">Toggle the table of contents</span> </label> <div class="vector-dropdown-content"> <div id="vector-sticky-header-toc-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <div class="vector-sticky-header-context-bar-primary" aria-hidden="true" ><span class="mw-page-title-main">Type system</span></div> </div> </div> <div class="vector-sticky-header-end" aria-hidden="true"> <div class="vector-sticky-header-icons"> <a href="#" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only" id="ca-talk-sticky-header" tabindex="-1" data-event-name="talk-sticky-header"><span class="vector-icon mw-ui-icon-speechBubbles mw-ui-icon-wikimedia-speechBubbles"></span> <span></span> </a> <a href="#" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only" id="ca-subject-sticky-header" tabindex="-1" data-event-name="subject-sticky-header"><span class="vector-icon mw-ui-icon-article mw-ui-icon-wikimedia-article"></span> <span></span> </a> <a href="#" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only" id="ca-history-sticky-header" tabindex="-1" data-event-name="history-sticky-header"><span class="vector-icon mw-ui-icon-wikimedia-history mw-ui-icon-wikimedia-wikimedia-history"></span> <span></span> </a> <a href="#" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only mw-watchlink" id="ca-watchstar-sticky-header" tabindex="-1" data-event-name="watch-sticky-header"><span class="vector-icon mw-ui-icon-wikimedia-star mw-ui-icon-wikimedia-wikimedia-star"></span> <span></span> </a> <a href="#" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only" id="ca-edit-sticky-header" tabindex="-1" data-event-name="wikitext-edit-sticky-header"><span class="vector-icon mw-ui-icon-wikimedia-wikiText mw-ui-icon-wikimedia-wikimedia-wikiText"></span> <span></span> </a> <a href="#" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only" id="ca-ve-edit-sticky-header" tabindex="-1" data-event-name="ve-edit-sticky-header"><span class="vector-icon mw-ui-icon-wikimedia-edit mw-ui-icon-wikimedia-wikimedia-edit"></span> <span></span> </a> <a href="#" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only" id="ca-viewsource-sticky-header" tabindex="-1" data-event-name="ve-edit-protected-sticky-header"><span class="vector-icon mw-ui-icon-wikimedia-editLock mw-ui-icon-wikimedia-wikimedia-editLock"></span> <span></span> </a> </div> <div class="vector-sticky-header-buttons"> <button class="cdx-button cdx-button--weight-quiet mw-interlanguage-selector" id="p-lang-btn-sticky-header" tabindex="-1" data-event-name="ui.dropdown-p-lang-btn-sticky-header"><span class="vector-icon mw-ui-icon-wikimedia-language mw-ui-icon-wikimedia-wikimedia-language"></span> <span>31 languages</span> </button> <a href="#" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--action-progressive" id="ca-addsection-sticky-header" tabindex="-1" data-event-name="addsection-sticky-header"><span class="vector-icon mw-ui-icon-speechBubbleAdd-progressive mw-ui-icon-wikimedia-speechBubbleAdd-progressive"></span> <span>Add topic</span> </a> </div> <div class="vector-sticky-header-icon-end"> <div class="vector-user-links"> </div> </div> </div> </div> </div> <div class="vector-settings" id="p-dock-bottom"> <ul></ul> </div><script>(RLQ=window.RLQ||[]).push(function(){mw.config.set({"wgHostname":"mw-web.codfw.canary-7cf7cb559d-td48l","wgBackendResponseTime":153,"wgPageParseReport":{"limitreport":{"cputime":"0.759","walltime":"1.049","ppvisitednodes":{"value":6294,"limit":1000000},"postexpandincludesize":{"value":123635,"limit":2097152},"templateargumentsize":{"value":7918,"limit":2097152},"expansiondepth":{"value":16,"limit":100},"expensivefunctioncount":{"value":49,"limit":500},"unstrip-depth":{"value":1,"limit":20},"unstrip-size":{"value":150849,"limit":5000000},"entityaccesscount":{"value":1,"limit":400},"timingprofile":["100.00% 789.888 1 -total"," 26.25% 207.322 3 Template:Reflist"," 14.28% 112.804 10 Template:Cite_book"," 9.30% 73.499 1 Template:Type_systems"," 9.11% 71.968 1 Template:Sidebar"," 7.57% 59.756 1 Template:Short_description"," 7.15% 56.460 16 Template:Cite_web"," 6.70% 52.937 4 Template:Sfn"," 5.97% 47.134 1 Template:Commonscatinline"," 5.59% 44.170 1 Template:More_footnotes"]},"scribunto":{"limitreport-timeusage":{"value":"0.421","limit":"10.000"},"limitreport-memusage":{"value":9412200,"limit":52428800},"limitreport-logs":"anchor_id_list = table#1 {\n [\"CITEREFBarendregtDekkersStatman2013\"] = 1,\n [\"CITEREFBracha\"] = 1,\n [\"CITEREFCardelli2004\"] = 1,\n [\"CITEREFCardelliWegner1985\"] = 1,\n [\"CITEREFKopylov2003\"] = 1,\n [\"CITEREFLaucherSnively2012\"] = 1,\n [\"CITEREFMeijerDrayton\"] = 1,\n [\"CITEREFMiglani2018\"] = 1,\n [\"CITEREFMitchellPlotkin1988\"] = 1,\n [\"CITEREFNordströmPeterssonSmith2001\"] = 1,\n [\"CITEREFPierce2002\"] = 1,\n [\"CITEREFRemy\"] = 1,\n [\"CITEREFSethi1996\"] = 1,\n [\"CITEREFSiek2014\"] = 1,\n [\"CITEREFSiekTaha2006\"] = 1,\n [\"CITEREFSkeet2019\"] = 1,\n [\"CITEREFSmith2011\"] = 1,\n [\"CITEREFTratt2009\"] = 1,\n [\"CITEREFTurner2012\"] = 1,\n [\"CITEREFWright1995\"] = 1,\n [\"CITEREFXi1998\"] = 1,\n [\"CITEREFXiPfenning1999\"] = 1,\n}\ntemplate_list = table#1 {\n [\"About\"] = 1,\n [\"C-lang\"] = 11,\n [\"Citation needed\"] = 1,\n [\"Cite book\"] = 10,\n [\"Cite conference\"] = 2,\n [\"Cite journal\"] = 2,\n [\"Cite thesis\"] = 2,\n [\"Cite web\"] = 16,\n [\"Clarify\"] = 1,\n [\"Code\"] = 2,\n [\"Commonscatinline\"] = 1,\n [\"Crossreference\"] = 1,\n [\"DEFAULTSORT:Type System\"] = 1,\n [\"Data types\"] = 1,\n [\"Efn\"] = 1,\n [\"Efn-la\"] = 2,\n [\"Essay\"] = 1,\n [\"Further\"] = 1,\n [\"GBurl\"] = 1,\n [\"Java\"] = 8,\n [\"Main\"] = 10,\n [\"More footnotes\"] = 1,\n [\"Mvar\"] = 11,\n [\"Notelist-la\"] = 1,\n [\"Portal\"] = 1,\n [\"Quote\"] = 1,\n [\"Reflist\"] = 2,\n [\"Rp\"] = 3,\n [\"Rust\"] = 2,\n [\"See also\"] = 2,\n [\"Sfn\"] = 4,\n [\"Short description\"] = 1,\n [\"Specify\"] = 1,\n [\"Type systems\"] = 1,\n [\"Who\"] = 3,\n [\"Wikibooks\"] = 2,\n}\narticle_whitelist = table#1 {\n}\nciteref_patterns = table#1 {\n}\n"},"cachereport":{"origin":"mw-web.codfw.main-65b64b4b74-kczqg","timestamp":"20250219122752","ttl":2592000,"transientcontent":false}}});});</script> <script type="application/ld+json">{"@context":"https:\/\/schema.org","@type":"Article","name":"Type system","url":"https:\/\/en.wikipedia.org\/wiki\/Type_system#Dynamic_type_checking_and_runtime_type_information","sameAs":"http:\/\/www.wikidata.org\/entity\/Q865760","mainEntity":"http:\/\/www.wikidata.org\/entity\/Q865760","author":{"@type":"Organization","name":"Contributors to Wikimedia projects"},"publisher":{"@type":"Organization","name":"Wikimedia Foundation, Inc.","logo":{"@type":"ImageObject","url":"https:\/\/www.wikimedia.org\/static\/images\/wmf-hor-googpub.png"}},"datePublished":"2003-03-22T01:34:17Z","dateModified":"2025-02-10T09:33:07Z","headline":"set of rules that assign a property called type to various constructs a computer program consists of, such as variables, expressions, functions or modules"}</script> </body> </html>