Knowledge (XXG)

Polymorphism (computer science)

Source đź“ť

1396: 1694:
Static polymorphism executes faster, because there is no dynamic dispatch overhead, but requires additional compiler support. Further, static polymorphism allows greater static analysis by compilers (notably for optimization), source code analysis tools, and human readers (programmers). Dynamic
1639:. The essence of the rank-polymorphic programming model is implicitly treating all operations as aggregate operations, usable on arrays with arbitrarily many dimensions, which is to say that rank polymorphism allows functions to be defined to operate on arrays of any shape and size. 1698:
Static polymorphism typically occurs in ad hoc polymorphism and parametric polymorphism, whereas dynamic polymorphism is usual for subtype polymorphism. However, it is possible to achieve static polymorphism with subtyping through more sophisticated use of
1527:) — a table of functions that implement the polymorphic part of the class interface—and each object contains a pointer to the vtable of its class, which is then consulted whenever a polymorphic method is called. This mechanism is an example of: 336:
functions seem to work generically over two types (integer and string) when looking at the invocations, but are considered to be two entirely distinct functions by the compiler for all intents and purposes:
316:
to refer to polymorphic functions that can be applied to arguments of different types, but that behave differently depending on the type of the argument to which they are applied (also known as
1120:) to restrict the range of types that can be used in a particular case of polymorphism. In these languages, subtyping allows a function to be written to take an object of a certain type 1695:
polymorphism is more flexible but slower—for example, dynamic polymorphism allows duck typing, and a dynamically linked library may operate on objects without knowing their full type.
1623:). A polytypic function is more general than polymorphic, and in such a function, "though one can provide fixed ad hoc cases for specific data types, an ad hoc combinator is absent". 1090:). Any parametrically polymorphic function is necessarily restricted in what it can do, working on the shape of the data instead of its value, leading to the concept of 328:" in this context is not intended to be pejorative; it refers simply to the fact that this form of polymorphism is not a fundamental feature of the type system. In the 1570: 255: 1513: 1544:(i.e., single-argument polymorphism), because virtual function calls are bound simply by looking through the vtable provided by the first argument (the 2282: 283: 2704: 1666:
Polymorphism can be distinguished by when the implementation is selected: statically (at compile time) or dynamically (at run time, typically via a
2653: 2287: 672:
Parametric polymorphism is ubiquitous in functional programming, where it is often simply referred to as "polymorphism". The following example in
181: 2724: 2277: 2272: 1462: 148: 1978: 1914: 2719: 2260: 2161: 1704: 1502: 642:
without depending on their type. Parametric polymorphism is a way to make a language more expressive while still maintaining full static
615:
languages the situation can be more complex as the correct function that needs to be invoked might only be determinable at run time.
2007: 1890: 1734:
for these libraries by default. As a result, more code can be shared for a reduced system size at the cost of runtime overhead.
2714: 2411: 1086:) formally developed this notion of polymorphism as an extension to lambda calculus (called the polymorphic lambda calculus or 2528: 2333: 2265: 2227: 2065: 673: 2129: 1490: 1133: 2734: 2428: 2358: 2206: 1731: 1601:. It allows the usage of all values whose types have certain properties, without losing the remaining type information. 2683: 1507: 329: 177: 162: 2438: 2306: 1727: 1636: 241:
developed significantly in the 1990s, with practical implementations beginning to appear by the end of the decade.
141: 2616: 2568: 2480: 2458: 2453: 2381: 2247: 1553: 264: 2490: 2154: 1700: 618: 2643: 2558: 630: 208: 70: 2386: 2242: 2201: 2196: 2051: 1923: 1797: 1598: 1574: 654: 2124: 259:, where they are listed as "the two main classes" of polymorphism. Ad hoc polymorphism was a feature of 2376: 2351: 1788: 134: 2134: 1852: 2729: 2178: 1909: 321: 317: 309: 250: 61: 56: 1928: 2709: 2648: 2626: 2553: 2406: 2398: 2318: 2147: 2056: 1802: 1748: 1711: 1653: 1610: 1458: 304: 200: 84: 47: 2081:
Slepak, Justin; Shivers, Olin; Manolios, Panagiotis (2019). "The semantics of rank polymorphism".
212:: not specifying concrete types and instead use abstract symbols that can substitute for any type. 2631: 2611: 2563: 2538: 2323: 2292: 2082: 1968: 1949: 1815: 1482: 122: 2023:
Wand, Mitchell (June 1989). "Type inference for record concatenation and multiple inheritance".
1824:: "Polymorphic types are types whose operations are applicable to values of more than one type." 2518: 2448: 2423: 2237: 2232: 2061: 2003: 1995: 1974: 1941: 1886: 1715: 1632: 1558: 890:
Parametric polymorphism is also available in several object-oriented languages. For instance,
612: 117: 891: 228:): when a name denotes instances of many different classes related by some common superclass. 2663: 2548: 2346: 2028: 1933: 1807: 1723: 1678: 1667: 1661: 1586: 1083: 1079: 895: 662: 107: 102: 79: 31: 676:
shows a parameterized list data type and two parametrically polymorphic functions on them:
657:. A function that can evaluate to or be applied to values of different types is known as a 2668: 2533: 2485: 2418: 1672: 1540: 1495: 112: 1780: 638:
allows a function or a data type to be written generically, so that it can handle values
621:
has also been defined as a form of polymorphism, referred to as "coercion polymorphism".
1835: 2621: 2443: 2433: 2341: 1569:
The interaction between parametric polymorphism and subtyping leads to the concepts of
1486: 2119: 2698: 2543: 1772: 1719: 1519: 1091: 275: 1953: 1489:). This particular kind of type hierarchy is known—especially in the context of the 1167:
In the following Java example we make cats and dogs subtypes of pets. The procedure
2500: 2475: 1819: 1776: 1657: 1532: 271: 1597:
Row polymorphism is a similar, but distinct concept from subtyping. It deals with
204:: defines a common interface for an arbitrary set of individually specified types. 17: 2678: 2673: 2523: 2470: 2297: 1878: 1592: 643: 238: 166: 2046:
Lämmel, Ralf; Visser, Joost (2002). "Typed Combinators for Generic Traversal".
1548:
object), so the runtime types of the other arguments are completely irrelevant.
2583: 2578: 2495: 2463: 2368: 2311: 1937: 1743: 1945: 2658: 2636: 2593: 2588: 2255: 2211: 2170: 2032: 1552:
The same goes for most other popular object systems. Some, however, such as
1536:, because virtual function calls are not bound until the time of invocation; 1103: 650: 216: 185: 93: 2103: 1857:
The Java™ Tutorials: Learning the Java Language: Interfaces and Inheritance
1840:
polymorphism – providing a single interface to entities of different types.
1395: 1171:
accepts a pet, but will also work correctly if a subtype is passed to it:
2573: 1087: 260: 2048:
Practical Aspects of Declarative Languages: 4th International Symposium
189: 1811: 1124:, but also work correctly, if passed an object that belongs to a type 192:
where an organism or species can have many different forms or stages.
27:
Using one interface or symbol with regards to multiple different types
1718:
as there is no way of knowing what types the parameters are when the
325: 287: 173:
is the use of a single symbol to represent multiple different types.
1517:). In typical implementations, each class contains what is called a 1164:. Subtype polymorphism is usually resolved dynamically (see below). 669:
like the generalized type from which such specializations are made.
2087: 1683:
and the corresponding forms of polymorphism are accordingly called
1473:, it may not even be possible to get your hands on an object whose 1457:. The actual type of the object can be hidden from clients into a 2025:
Proceedings. Fourth Annual Symposium on Logic in Computer Science
1877:
Conallen, J.; Engle, M.; Houston, K.; Maksimchuk, R.; Young, B.;
2191: 661:
A data type that can appear to be of a generalized type (e.g. a
2143: 2186: 195:
The most commonly recognized major forms of polymorphism are:
2139: 1781:"On understanding types, data abstraction, and polymorphism" 1441:
that is a supertype of them), a function written to take a
1912:(2000). "Fundamental Concepts in Programming Languages". 1631:
Rank polymorphism is one of the defining features of the
2104:"How Swift Achieved Dynamic Linking Where Rust Couldn't" 263:, while parametric polymorphism was the core feature of 649:
The concept of parametric polymorphism applies to both
1883:
Object-Oriented Analysis and Design with Applications
1730:
makes extensive use of dynamic dispatch to build the
1973:(2nd ed.). Taylor & Francis. pp. 91–. 2602: 2511: 2397: 2367: 2332: 2220: 2177: 290:as the first programming language to implement it. 1722:is built. While languages like C++ and Rust use 1611:Generic programming § Functional languages 665:with elements of arbitrary type) is designated 188:. The concept is borrowed from a principle in 1562:, under which method calls are polymorphic in 2155: 1714:, static polymorphism becomes impossible for 256:Fundamental Concepts in Programming Languages 142: 8: 1904: 1902: 180:, polymorphism is the provision of a single 1136:). This type relation is sometimes written 2162: 2148: 2140: 2050:. Springer. pp. 137–154, See p. 153. 149: 135: 36: 2135:Polymorphism Java Documentation on Oracle 2086: 2055: 1927: 1801: 2125:Objects and Polymorphism (Visual Prolog) 1499:, and usually contains many more types. 1834:Bjarne Stroustrup (February 19, 2007). 1759: 92: 69: 46: 39: 1767: 1765: 1763: 1445:will work equally well when passed an 1915:Higher-Order and Symbolic Computation 1503:Object-oriented programming languages 7: 1705:curiously recurring template pattern 1885:(3rd ed.). Pearson Education. 1710:When polymorphism is exposed via a 1836:"Bjarne Stroustrup's C++ Glossary" 1108:Some languages employ the idea of 25: 1670:). This is known respectively as 1505:offer subtype polymorphism using 1996:"23.2 Varieties of Polymorphism" 1394: 894:in C++ and D, or under the name 2705:Polymorphism (computer science) 2000:Types and Programming Languages 1648:Static and dynamic polymorphism 600:// prints "Added Jay" 1: 2725:Programming language concepts 2228:Arbitrary-precision or bignum 2002:. MIT Press. pp. 340–1. 1134:Liskov substitution principle 249:were originally described in 2120:C++ examples of polymorphism 1732:application binary interface 898:in C#, Delphi, Java and Go: 558:// prints "Sum: 3" 2720:Object-oriented programming 1633:array programming languages 1491:Scheme programming language 178:object-oriented programming 163:programming language theory 108:Single and dynamic dispatch 2751: 1728:Swift programming language 1651: 1608: 1590: 1584: 1461:, and accessed via object 1101: 628: 302: 29: 2569:Strongly typed identifier 1970:Computer Science Handbook 1967:Tucker, Allen B. (2004). 1554:Common Lisp Object System 184:to entities of different 1701:template metaprogramming 1173: 900: 678: 619:Implicit type conversion 339: 237:Interest in polymorphic 30:Not to be confused with 2644:Parametric polymorphism 2033:10.1109/LICS.1989.39162 1938:10.1023/A:1010000313106 1401:In another example, if 636:Parametric polymorphism 631:Parametric polymorphism 625:Parametric polymorphism 247:parametric polymorphism 209:Parametric polymorphism 71:Parametric polymorphism 2715:Functional programming 1643:Implementation aspects 1575:bounded quantification 1437:as subtypes of a type 1118:inclusion polymorphism 282:to model subtypes and 280:inclusion polymorphism 226:inclusion polymorphism 2102:Beingessner, Alexis. 1994:Pierce, B.C. (2002). 1910:Strachey, Christopher 1789:ACM Computing Surveys 1615:A related concept is 1128:that is a subtype of 667:polymorphic data type 659:polymorphic function. 2130:Polymorphism on MSDN 1689:dynamic polymorphism 1621:data type genericity 1413:are types such that 1114:subtype polymorphism 322:operator overloading 318:function overloading 310:Christopher Strachey 278:introduced the term 251:Christopher Strachey 222:subtype polymorphism 62:Operator overloading 57:Function overloading 2735:Generic programming 2649:Primitive data type 2554:Recursive data type 2407:Algebraic data type 2283:Quadruple precision 1749:Virtual inheritance 1685:static polymorphism 1654:Static polymorphism 332:example below, the 314:ad hoc polymorphism 305:Ad hoc polymorphism 299:Ad hoc polymorphism 243:Ad hoc polymorphism 201:Ad hoc polymorphism 85:Generic programming 48:Ad hoc polymorphism 2612:Abstract data type 2293:Extended precision 2252:Reduced precision 2027:. pp. 92–97. 1483:abstract data type 1465:. In fact, if the 1132:(according to the 438:"Added " 123:Predicate dispatch 2692: 2691: 2424:Associative array 2288:Octuple precision 1980:978-1-58488-360-9 1812:10.1145/6041.6042 1779:(December 1985). 1716:dynamic libraries 1627:Rank polymorphism 1559:multiple dispatch 1453:as when passed a 1425: :>  1417: :>  1275:"Woof!" 1233:"Meow!" 1160: :>  1140: <:  613:dynamically typed 387:"Sum: " 270:In a 1985 paper, 159: 158: 118:Multiple dispatch 18:Type polymorphism 16:(Redirected from 2742: 2664:Type constructor 2549:Opaque data type 2481:Record or Struct 2278:Double precision 2273:Single precision 2164: 2157: 2150: 2141: 2108: 2107: 2099: 2093: 2092: 2090: 2078: 2072: 2071: 2059: 2043: 2037: 2036: 2020: 2014: 2013: 1991: 1985: 1984: 1964: 1958: 1957: 1931: 1906: 1897: 1896: 1874: 1868: 1867: 1865: 1864: 1849: 1843: 1842: 1831: 1825: 1823: 1805: 1785: 1769: 1679:dynamic dispatch 1668:virtual function 1662:Dynamic dispatch 1599:structural types 1587:Row polymorphism 1581:Row polymorphism 1547: 1523:(shortly called 1398: 1390: 1387: 1384: 1381: 1378: 1375: 1372: 1369: 1366: 1363: 1360: 1357: 1354: 1351: 1348: 1345: 1342: 1339: 1336: 1333: 1330: 1327: 1324: 1321: 1318: 1315: 1312: 1309: 1306: 1303: 1300: 1297: 1294: 1291: 1288: 1285: 1282: 1279: 1276: 1273: 1270: 1267: 1264: 1261: 1258: 1255: 1252: 1249: 1246: 1243: 1240: 1237: 1234: 1231: 1228: 1225: 1222: 1219: 1216: 1213: 1210: 1207: 1204: 1201: 1198: 1195: 1192: 1189: 1186: 1183: 1180: 1177: 1170: 1148:is said to be a 1084:Jean-Yves Girard 1080:John C. Reynolds 1075: 1072: 1069: 1066: 1063: 1060: 1057: 1054: 1051: 1048: 1045: 1042: 1039: 1036: 1033: 1030: 1027: 1024: 1021: 1018: 1015: 1012: 1009: 1006: 1003: 1000: 997: 994: 991: 988: 985: 982: 979: 976: 973: 970: 967: 964: 961: 958: 955: 952: 949: 946: 943: 940: 937: 934: 931: 928: 925: 922: 919: 916: 913: 910: 907: 904: 886: 883: 880: 877: 874: 871: 868: 865: 862: 859: 856: 853: 850: 847: 844: 841: 838: 835: 832: 829: 826: 823: 820: 817: 814: 811: 808: 805: 802: 799: 796: 793: 790: 787: 784: 781: 778: 775: 772: 769: 766: 763: 760: 757: 754: 751: 748: 745: 742: 739: 736: 733: 730: 727: 724: 721: 718: 715: 712: 709: 706: 703: 700: 697: 694: 691: 688: 685: 682: 607: 604: 601: 598: 595: 592: 589: 586: 583: 580: 577: 574: 571: 568: 565: 562: 559: 556: 553: 550: 547: 544: 541: 538: 535: 532: 529: 526: 523: 520: 517: 514: 511: 508: 507:AdHocPolymorphic 505: 502: 499: 496: 495:AdHocPolymorphic 493: 490: 487: 484: 481: 478: 475: 472: 469: 466: 463: 460: 457: 454: 451: 448: 445: 442: 439: 436: 433: 430: 427: 424: 421: 418: 415: 412: 409: 406: 403: 400: 397: 394: 391: 388: 385: 382: 379: 376: 373: 370: 367: 364: 361: 358: 355: 352: 349: 346: 345:AdHocPolymorphic 343: 335: 267:'s type system. 151: 144: 137: 103:Virtual function 80:Generic function 37: 32:Polymorphic code 21: 2750: 2749: 2745: 2744: 2743: 2741: 2740: 2739: 2695: 2694: 2693: 2688: 2669:Type conversion 2604: 2598: 2534:Enumerated type 2507: 2393: 2387:null-terminated 2363: 2328: 2216: 2173: 2168: 2116: 2111: 2101: 2100: 2096: 2080: 2079: 2075: 2068: 2045: 2044: 2040: 2022: 2021: 2017: 2010: 1993: 1992: 1988: 1981: 1966: 1965: 1961: 1929:10.1.1.332.3161 1908: 1907: 1900: 1893: 1876: 1875: 1871: 1862: 1860: 1851: 1850: 1846: 1833: 1832: 1828: 1783: 1771: 1770: 1761: 1757: 1740: 1726:templates, the 1673:static dispatch 1664: 1652:Main articles: 1650: 1645: 1629: 1613: 1607: 1595: 1589: 1583: 1545: 1541:single dispatch 1511:(also known as 1496:numerical tower 1392: 1391: 1388: 1385: 1382: 1379: 1376: 1373: 1370: 1367: 1364: 1361: 1358: 1355: 1352: 1349: 1346: 1343: 1340: 1337: 1334: 1331: 1328: 1325: 1322: 1319: 1316: 1313: 1310: 1307: 1304: 1301: 1298: 1295: 1292: 1289: 1286: 1283: 1280: 1277: 1274: 1271: 1268: 1265: 1262: 1259: 1256: 1253: 1250: 1247: 1244: 1241: 1238: 1235: 1232: 1229: 1226: 1223: 1220: 1217: 1214: 1211: 1208: 1205: 1202: 1199: 1196: 1193: 1190: 1187: 1184: 1181: 1178: 1175: 1168: 1106: 1100: 1077: 1076: 1073: 1070: 1067: 1064: 1061: 1058: 1055: 1052: 1049: 1046: 1043: 1040: 1037: 1034: 1031: 1028: 1025: 1022: 1019: 1016: 1013: 1010: 1007: 1004: 1001: 998: 995: 992: 989: 986: 983: 980: 977: 974: 971: 968: 965: 962: 959: 956: 953: 950: 947: 944: 941: 938: 935: 932: 929: 926: 923: 920: 917: 914: 911: 908: 905: 902: 888: 887: 884: 881: 878: 875: 872: 869: 866: 863: 860: 857: 854: 851: 848: 845: 842: 839: 836: 833: 830: 827: 824: 821: 818: 815: 812: 809: 806: 803: 800: 797: 794: 791: 788: 785: 782: 779: 776: 773: 770: 767: 764: 761: 758: 755: 752: 749: 746: 743: 740: 737: 734: 731: 728: 725: 722: 719: 716: 713: 710: 707: 704: 701: 698: 695: 692: 689: 686: 683: 680: 633: 627: 609: 608: 605: 602: 599: 596: 593: 591:"Jay" 590: 587: 584: 581: 578: 575: 572: 569: 566: 563: 560: 557: 554: 551: 548: 545: 542: 539: 536: 533: 530: 527: 524: 521: 518: 515: 512: 509: 506: 503: 500: 497: 494: 491: 488: 485: 482: 479: 476: 473: 470: 467: 464: 461: 458: 455: 452: 449: 446: 443: 440: 437: 434: 431: 428: 425: 422: 419: 416: 413: 410: 407: 404: 401: 398: 395: 392: 389: 386: 383: 380: 377: 374: 371: 368: 365: 362: 359: 356: 353: 350: 347: 344: 341: 333: 312:chose the term 307: 301: 296: 235: 155: 113:Double dispatch 35: 28: 23: 22: 15: 12: 11: 5: 2748: 2746: 2738: 2737: 2732: 2727: 2722: 2717: 2712: 2707: 2697: 2696: 2690: 2689: 2687: 2686: 2681: 2676: 2671: 2666: 2661: 2656: 2651: 2646: 2641: 2640: 2639: 2629: 2624: 2622:Data structure 2619: 2614: 2608: 2606: 2600: 2599: 2597: 2596: 2591: 2586: 2581: 2576: 2571: 2566: 2561: 2556: 2551: 2546: 2541: 2536: 2531: 2526: 2521: 2515: 2513: 2509: 2508: 2506: 2505: 2504: 2503: 2493: 2488: 2483: 2478: 2473: 2468: 2467: 2466: 2456: 2451: 2446: 2441: 2436: 2431: 2426: 2421: 2416: 2415: 2414: 2403: 2401: 2395: 2394: 2392: 2391: 2390: 2389: 2379: 2373: 2371: 2365: 2364: 2362: 2361: 2356: 2355: 2354: 2349: 2338: 2336: 2330: 2329: 2327: 2326: 2321: 2316: 2315: 2314: 2304: 2303: 2302: 2301: 2300: 2290: 2285: 2280: 2275: 2270: 2269: 2268: 2263: 2261:Half precision 2258: 2248:Floating point 2245: 2240: 2235: 2230: 2224: 2222: 2218: 2217: 2215: 2214: 2209: 2204: 2199: 2194: 2189: 2183: 2181: 2175: 2174: 2169: 2167: 2166: 2159: 2152: 2144: 2138: 2137: 2132: 2127: 2122: 2115: 2114:External links 2112: 2110: 2109: 2094: 2073: 2066: 2057:10.1.1.18.5727 2038: 2015: 2008: 1986: 1979: 1959: 1922:(1/2): 11–49. 1898: 1891: 1869: 1853:"Polymorphism" 1844: 1826: 1803:10.1.1.117.695 1796:(4): 471–523. 1773:Cardelli, Luca 1758: 1756: 1753: 1752: 1751: 1746: 1739: 1736: 1649: 1646: 1644: 1641: 1628: 1625: 1609:Main article: 1606: 1603: 1585:Main article: 1582: 1579: 1550: 1549: 1537: 1487:abstract class 1174: 1144:. Conversely, 1102:Main article: 1099: 1096: 901: 679: 629:Main article: 626: 623: 340: 303:Main article: 300: 297: 295: 292: 234: 231: 230: 229: 213: 205: 157: 156: 154: 153: 146: 139: 131: 128: 127: 126: 125: 120: 115: 110: 105: 97: 96: 90: 89: 88: 87: 82: 74: 73: 67: 66: 65: 64: 59: 51: 50: 44: 43: 26: 24: 14: 13: 10: 9: 6: 4: 3: 2: 2747: 2736: 2733: 2731: 2728: 2726: 2723: 2721: 2718: 2716: 2713: 2711: 2708: 2706: 2703: 2702: 2700: 2685: 2682: 2680: 2677: 2675: 2672: 2670: 2667: 2665: 2662: 2660: 2657: 2655: 2652: 2650: 2647: 2645: 2642: 2638: 2635: 2634: 2633: 2630: 2628: 2625: 2623: 2620: 2618: 2615: 2613: 2610: 2609: 2607: 2601: 2595: 2592: 2590: 2587: 2585: 2582: 2580: 2577: 2575: 2572: 2570: 2567: 2565: 2562: 2560: 2557: 2555: 2552: 2550: 2547: 2545: 2544:Function type 2542: 2540: 2537: 2535: 2532: 2530: 2527: 2525: 2522: 2520: 2517: 2516: 2514: 2510: 2502: 2499: 2498: 2497: 2494: 2492: 2489: 2487: 2484: 2482: 2479: 2477: 2474: 2472: 2469: 2465: 2462: 2461: 2460: 2457: 2455: 2452: 2450: 2447: 2445: 2442: 2440: 2437: 2435: 2432: 2430: 2427: 2425: 2422: 2420: 2417: 2413: 2410: 2409: 2408: 2405: 2404: 2402: 2400: 2396: 2388: 2385: 2384: 2383: 2380: 2378: 2375: 2374: 2372: 2370: 2366: 2360: 2357: 2353: 2350: 2348: 2345: 2344: 2343: 2340: 2339: 2337: 2335: 2331: 2325: 2322: 2320: 2317: 2313: 2310: 2309: 2308: 2305: 2299: 2296: 2295: 2294: 2291: 2289: 2286: 2284: 2281: 2279: 2276: 2274: 2271: 2267: 2264: 2262: 2259: 2257: 2254: 2253: 2251: 2250: 2249: 2246: 2244: 2241: 2239: 2236: 2234: 2231: 2229: 2226: 2225: 2223: 2219: 2213: 2210: 2208: 2205: 2203: 2200: 2198: 2195: 2193: 2190: 2188: 2185: 2184: 2182: 2180: 2179:Uninterpreted 2176: 2172: 2165: 2160: 2158: 2153: 2151: 2146: 2145: 2142: 2136: 2133: 2131: 2128: 2126: 2123: 2121: 2118: 2117: 2113: 2105: 2098: 2095: 2089: 2084: 2077: 2074: 2069: 2063: 2058: 2053: 2049: 2042: 2039: 2034: 2030: 2026: 2019: 2016: 2011: 2009:9780262162098 2005: 2001: 1997: 1990: 1987: 1982: 1976: 1972: 1971: 1963: 1960: 1955: 1951: 1947: 1943: 1939: 1935: 1930: 1925: 1921: 1917: 1916: 1911: 1905: 1903: 1899: 1894: 1892:9780132797443 1888: 1884: 1880: 1873: 1870: 1858: 1854: 1848: 1845: 1841: 1837: 1830: 1827: 1821: 1817: 1813: 1809: 1804: 1799: 1795: 1791: 1790: 1782: 1778: 1777:Wegner, Peter 1774: 1768: 1766: 1764: 1760: 1754: 1750: 1747: 1745: 1742: 1741: 1737: 1735: 1733: 1729: 1725: 1724:monomorphized 1721: 1720:shared object 1717: 1713: 1708: 1706: 1703:, namely the 1702: 1696: 1692: 1690: 1686: 1682: 1680: 1675: 1674: 1669: 1663: 1659: 1655: 1647: 1642: 1640: 1638: 1634: 1626: 1624: 1622: 1618: 1612: 1604: 1602: 1600: 1594: 1588: 1580: 1578: 1576: 1572: 1567: 1565: 1561: 1560: 1555: 1543: 1542: 1538: 1535: 1534: 1530: 1529: 1528: 1526: 1522: 1521: 1520:virtual table 1516: 1515: 1510: 1509: 1504: 1500: 1498: 1497: 1492: 1488: 1484: 1480: 1476: 1472: 1468: 1464: 1460: 1456: 1452: 1448: 1444: 1440: 1436: 1432: 1428: 1424: 1420: 1416: 1412: 1408: 1404: 1399: 1397: 1172: 1165: 1163: 1159: 1155: 1151: 1147: 1143: 1139: 1135: 1131: 1127: 1123: 1119: 1115: 1112:(also called 1111: 1105: 1097: 1095: 1093: 1092:parametricity 1089: 1085: 1081: 899: 897: 893: 677: 675: 670: 668: 664: 660: 656: 652: 647: 645: 641: 637: 632: 624: 622: 620: 616: 614: 338: 331: 327: 324:). The term " 323: 319: 315: 311: 306: 298: 293: 291: 289: 285: 281: 277: 276:Luca Cardelli 273: 268: 266: 262: 258: 257: 252: 248: 244: 240: 232: 227: 223: 220:(also called 219: 218: 214: 211: 210: 206: 203: 202: 198: 197: 196: 193: 191: 187: 183: 179: 174: 172: 168: 164: 152: 147: 145: 140: 138: 133: 132: 130: 129: 124: 121: 119: 116: 114: 111: 109: 106: 104: 101: 100: 99: 98: 95: 91: 86: 83: 81: 78: 77: 76: 75: 72: 68: 63: 60: 58: 55: 54: 53: 52: 49: 45: 42: 38: 33: 19: 2449:Intersection 2097: 2076: 2047: 2041: 2024: 2018: 1999: 1989: 1969: 1962: 1919: 1913: 1882: 1872: 1861:. Retrieved 1856: 1847: 1839: 1829: 1793: 1787: 1709: 1697: 1693: 1688: 1684: 1677: 1671: 1665: 1658:Late binding 1630: 1620: 1616: 1614: 1596: 1568: 1563: 1557: 1551: 1539: 1533:late binding 1531: 1524: 1518: 1512: 1506: 1501: 1494: 1478: 1475:most-derived 1474: 1470: 1466: 1454: 1450: 1446: 1442: 1438: 1434: 1430: 1426: 1422: 1418: 1414: 1410: 1406: 1402: 1400: 1393: 1166: 1161: 1157: 1153: 1149: 1145: 1141: 1137: 1129: 1125: 1121: 1117: 1113: 1109: 1107: 1078: 889: 671: 666: 658: 648: 639: 635: 634: 617: 610: 313: 308: 279: 272:Peter Wegner 269: 254: 246: 242: 239:type systems 236: 225: 221: 215: 207: 199: 194: 175: 171:polymorphism 170: 160: 41:Polymorphism 40: 2730:Type theory 2679:Type theory 2674:Type system 2524:Bottom type 2471:Option type 2412:generalized 2298:Long double 2243:Fixed point 1593:Duck typing 1566:arguments. 1514:inheritance 1508:subclassing 1082:(and later 644:type-safety 284:inheritance 167:type theory 2710:Data types 2699:Categories 2584:Empty type 2579:Type class 2529:Collection 2486:Refinement 2464:metaobject 2312:signedness 2171:Data types 2088:1907.00509 2067:354043092X 1863:2021-09-08 1755:References 1744:Type class 1617:polytypism 1605:Polytypism 1591:See also: 1556:, provide 1169:letsHear() 651:data types 2659:Subtyping 2654:Interface 2637:metaclass 2589:Unit type 2559:Semaphore 2539:Exception 2444:Inductive 2434:Dependent 2399:Composite 2377:Character 2359:Reference 2256:Minifloat 2212:Bit array 2052:CiteSeerX 1946:1573-0557 1924:CiteSeerX 1879:Booch, G. 1798:CiteSeerX 1459:black box 1156:—written 1150:supertype 1110:subtyping 1104:Subtyping 1098:Subtyping 892:templates 655:functions 640:uniformly 286:, citing 217:Subtyping 182:interface 94:Subtyping 2684:Variable 2574:Top type 2439:Equality 2347:physical 2324:Rational 2319:Interval 2266:bfloat16 1954:14124601 1881:(2007). 1859:. Oracle 1738:See also 1571:variance 1477:type is 1471:abstract 1469:type is 1463:identity 1451:Rational 1431:Rational 1419:Rational 1407:Rational 1374:letsHear 1359:letsHear 1293:letsHear 1188:abstract 1176:abstract 1088:System F 896:generics 261:ALGOL 68 2627:Generic 2603:Related 2519:Boolean 2476:Product 2352:virtual 2342:Address 2334:Pointer 2307:Integer 2238:Decimal 2233:Complex 2221:Numeric 1820:2921816 1712:library 1635:, like 1447:Integer 1435:Integer 1427:Integer 1411:Integer 1314:println 1251:extends 1209:extends 732:Integer 674:Haskell 573:println 525:println 233:History 190:biology 2617:Boxing 2605:topics 2564:Stream 2501:tagged 2459:Object 2382:String 2064:  2054:  2006:  1977:  1952:  1944:  1926:  1889:  1818:  1800:  1660:, and 1525:vtable 1493:—as a 1479:Number 1467:Number 1455:Number 1443:Number 1439:Number 1423:Number 1415:Number 1409:, and 1403:Number 1347:String 1335:static 1287:static 1272:return 1260:String 1230:return 1218:String 1191:String 990:length 774:length 747:length 735:length 717:length 561:System 513:System 483:String 471:static 468:public 456:public 435:return 423:String 414:String 411:public 384:return 354:String 351:public 326:ad hoc 288:Simula 2512:Other 2496:Union 2429:Class 2419:Array 2202:Tryte 2083:arXiv 1950:S2CID 1816:S2CID 1784:(PDF) 1481:(see 1326:speak 1299:final 1263:speak 1245:class 1221:speak 1203:class 1194:speak 1179:class 921:class 903:class 810:-> 801:-> 792:-> 729:-> 462:adhoc 459:class 342:class 294:Forms 186:types 2632:Kind 2594:Void 2454:List 2369:Text 2207:Word 2197:Trit 2192:Byte 2062:ISBN 2004:ISBN 1975:ISBN 1942:ISSN 1887:ISBN 1687:and 1676:and 1619:(or 1573:and 1546:this 1433:and 1421:and 1386:()); 1371:()); 1350:args 1341:main 1338:void 1329:()); 1290:void 1059:> 1053:< 1050:List 1041:> 1029:< 1026:Func 1017:> 1011:< 1008:List 981:head 978:> 972:< 969:Node 960:next 957:> 951:< 948:Node 942:elem 933:> 927:< 924:Node 915:> 909:< 906:List 858:Cons 843:Cons 813:List 804:List 753:Cons 723:List 708:List 699:Cons 684:List 681:data 663:list 653:and 579:poly 531:poly 498:poly 486:args 477:main 474:void 444:name 426:name 330:Java 274:and 245:and 165:and 2491:Set 2187:Bit 2029:doi 1934:doi 1808:doi 1637:APL 1564:all 1449:or 1383:Dog 1380:new 1368:Cat 1365:new 1320:pet 1305:pet 1302:Pet 1254:Pet 1248:Dog 1212:Pet 1206:Cat 1197:(); 1182:Pet 1152:of 1116:or 1071:... 1020:map 999:... 987:int 876:map 834:map 831:Nil 825:Nil 819:map 780:map 738:Nil 693:Nil 611:In 585:add 567:out 537:add 519:out 510:(); 504:new 417:add 372:int 363:int 357:add 334:Add 320:or 253:'s 224:or 176:In 161:In 2701:: 2060:. 1998:. 1948:. 1940:. 1932:. 1920:13 1918:. 1901:^ 1855:. 1838:. 1814:. 1806:. 1794:17 1792:. 1786:. 1775:; 1762:^ 1707:. 1691:. 1656:, 1577:. 1485:, 1405:, 1266:() 1224:() 1094:. 1062:xs 993:() 882:xs 849:xs 783::: 777:xs 759:xs 720::: 646:. 597:); 555:); 405:); 265:ML 169:, 2163:e 2156:t 2149:v 2106:. 2091:. 2085:: 2070:. 2035:. 2031:: 2012:. 1983:. 1956:. 1936:: 1895:. 1866:. 1822:. 1810:: 1681:, 1429:( 1389:} 1377:( 1362:( 1356:{ 1353:) 1344:( 1332:} 1323:. 1317:( 1311:{ 1308:) 1296:( 1284:} 1281:} 1278:; 1269:{ 1257:{ 1242:} 1239:} 1236:; 1227:{ 1215:{ 1200:} 1185:{ 1162:S 1158:T 1154:S 1146:T 1142:T 1138:S 1130:T 1126:S 1122:T 1074:} 1068:{ 1065:) 1056:A 1047:, 1044:f 1038:B 1035:, 1032:A 1023:( 1014:B 1005:} 1002:} 996:{ 984:; 975:T 966:} 963:; 954:T 945:; 939:T 936:{ 930:T 918:{ 912:T 885:) 879:f 873:( 870:) 867:x 864:f 861:( 855:= 852:) 846:x 840:( 837:f 828:= 822:f 816:b 807:a 798:) 795:b 789:a 786:( 771:+ 768:1 765:= 762:) 756:x 750:( 744:0 741:= 726:a 714:) 711:a 705:( 702:a 696:| 690:= 687:a 606:} 603:} 594:) 588:( 582:. 576:( 570:. 564:. 552:) 549:2 546:, 543:1 540:( 534:. 528:( 522:. 516:. 501:= 492:{ 489:) 480:( 465:{ 453:} 450:} 447:; 441:+ 432:{ 429:) 420:( 408:} 402:y 399:+ 396:x 393:( 390:+ 381:{ 378:) 375:y 369:, 366:x 360:( 348:{ 150:e 143:t 136:v 34:. 20:)

Index

Type polymorphism
Polymorphic code
Polymorphism
Ad hoc polymorphism
Function overloading
Operator overloading
Parametric polymorphism
Generic function
Generic programming
Subtyping
Virtual function
Single and dynamic dispatch
Double dispatch
Multiple dispatch
Predicate dispatch
v
t
e
programming language theory
type theory
object-oriented programming
interface
types
biology
Ad hoc polymorphism
Parametric polymorphism
Subtyping
type systems
Christopher Strachey
Fundamental Concepts in Programming Languages

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.

↑