<!--DEBUG:--><!--DEBUG:dc3-united-states-software-in-english-pdf-2--><!--DEBUG:--><!--DEBUG:dc3-united-states-software-in-english-pdf-2--><!--DEBUG-spv-->{"id":413914,"date":"2017-01-19T18:29:16","date_gmt":"2017-01-19T16:29:16","guid":{"rendered":"http:\/\/nhub.news\/?p=413914"},"modified":"2017-01-19T18:29:16","modified_gmt":"2017-01-19T16:29:16","slug":"bjarne-stroustrup-mines-generic-programming-for-a-better-c","status":"publish","type":"post","link":"http:\/\/nhub.news\/fr\/2017\/01\/bjarne-stroustrup-mines-generic-programming-for-a-better-c\/","title":{"rendered":"Bjarne Stroustrup mines generic programming for a better C++"},"content":{"rendered":"<p style=\"text-align: justify;\"><img style=\"float: left; padding: 5px;\" width=\"300px\" src=\"http:\/\/cdn.computerworld.com.au\/article\/images\/800x800\/dimg\/light-bulb-100704100-orig.jpg\" alt=\"NewsHub\" border=\"0\" \/>Bjarne Stroustrup is on a mission to simplify generic programming.<br \/>In a recently published paper titled \u00a0\u00bb Concepts: The Future of Generic Programming ,\u00a0\u00bb Stroustrup makes the case for concepts as a foundation for generic programming. In concepts, Stroustrup sees the solution to the interface specification problem that has long dogged C++, the language he founded more than 35 years ago.<br \/>\u201cThe way we write generic code today is simply too different from the way we write other code,\u201d Stroustrup says.<br \/>Stroustrup defines generic programming as programming focused on design and implementation of general algorithms, with algorithms capable of accepting a variety of types. Generic programming can also be used to write efficient libraries. Stroustrup hopes to see his ideas come to fruition in C++ in fewer than three years. Concepts, Stroustrup believes, will greatly ease engineers\u2019 ability to write efficient, reliable C++ code.<br \/>Currently an ISO technical specification, concepts provide well-specified interfaces to templates without runtime overhead. Concepts, Stroustrup writes, are intended to complete C++\u2019s support for generic programming as initially envisioned. \u201cThe purpose of concepts is to fundamentally simplify and improve design. This leads to fewer bugs and clearer &#8212; often shorter &#8212; code.\u201d<br \/>The most obvious effect will be a massive improvement in the quality of error messages, but the most important long-term effect will be found in the flexibility and clarity of code, Stroustrup says. \u201cIn particular, having well-specified interfaces allows for simple, general and zero-overhead overloading of templates. That simplifies much generic code.\u201d<br \/>Concepts also address the long-standing problem of template syntax being too heavy. Stroustrup\u2019s solution will allow programmers to test the type of template arguments against user-defined compile-time predicates.<br \/>Concepts currently are available as part of GNU C Compiler 6.2. Stroustrup would like to see them be part of C++ 20.<br \/>\u201cI hope all major C++ implementations will support concepts well before 2020. IMO, concepts should have been part of C++ 17 , but the committee couldn\u2019t reach consensus on that,\u201d Stroustrup writes.<br \/>Once concepts are in the standard working paper, they can then be used to simplify the standard library and to introduce Ranges, a modernized version of the standard library featuring concepts.<br \/>Concepts are meant to complete C++\u2019s support for generic programming as initially envisioned.<br \/>Stroustrup recalls what he had in mind: \u201cI wanted three properties for templates: full generality\/expressiveness, zero overhead compared to hand coding [and] well-specified interfaces.\u201d<br \/>But no one could figure out how to get all three, so C++ ended up with Turing completeness and better-than-hand-coding performance but lousy interfaces &#8212; basically compile-time duck typing, in which a function accepts any type that has the properties that the implementation happens to use, instead of checking types in interfaces. This situation can result in complicated code.<br \/>While Stroustrup focuses on C++, his solution could be applied to other languages.<br \/>\u201cThe basic ideas are very general,\u201d Stroustrup writes. \u201cThe idea of applying a compile-time predicate can be applied to any compiled language, and many languages offer some variant of the idea.\u201d<br \/>More about Concepts ISO<\/p>\n<div id=\"td_post_ranks\" class=\"td-post-comments\" style=\"vertical-align: middle;\">\n<div style=\"float: left;\">\nSimilarity rank: 0\n<\/div>\n<\/div>\n<p><script>\njQuery(function() {\nvar mainContentMetaInfo = '.td-post-header .meta-info';\nvar tdPostRanks = '#td_post_ranks';\nif (jQuery(tdPostRanks).length) {\n    var tdPostRanksHtml = jQuery(tdPostRanks).get(0).outerHTML;\n    if (typeof tdPostRanksHtml != 'undefined') {\n        jQuery(tdPostRanks).remove();\n        jQuery(mainContentMetaInfo).append(tdPostRanksHtml);\n    }\n}\n});\n<\/script><span>&copy; Source: <a href=\"http:\/\/www.computerworld.com.au\/article\/612945\/bjarne-stroustrup-mines-generic-programming-better-c\/?utm_medium=rss&amp;utm_source=sectionfeed\" target=\"_blank\">http:\/\/www.computerworld.com.au\/article\/612945\/bjarne-stroustrup-mines-generic-programming-better-c\/?utm_medium=rss&amp;utm_source=sectionfeed<\/a><br \/>All rights are reserved and belongs to a source media.<\/span><\/p>\n<script>jQuery(function(){jQuery(\"#td_post_ranks\").remove();});<\/script><script>jQuery(function(){jQuery(\".td-post-content\").find(\"p\").find(\"img\").hide();});<\/script>","protected":false},"excerpt":{"rendered":"<p>Bjarne Stroustrup is on a mission to simplify generic programming.In a recently published paper titled \u00a0\u00bb Concepts: The Future of Generic Programming ,\u00a0\u00bb Stroustrup makes the case for concepts as a foundation for generic programming. In concepts, Stroustrup sees the solution to the interface specification problem that has long dogged C++, the language he founded [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":413913,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[93],"tags":[],"_links":{"self":[{"href":"http:\/\/nhub.news\/fr\/wp-json\/wp\/v2\/posts\/413914"}],"collection":[{"href":"http:\/\/nhub.news\/fr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/nhub.news\/fr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/nhub.news\/fr\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/nhub.news\/fr\/wp-json\/wp\/v2\/comments?post=413914"}],"version-history":[{"count":1,"href":"http:\/\/nhub.news\/fr\/wp-json\/wp\/v2\/posts\/413914\/revisions"}],"predecessor-version":[{"id":413915,"href":"http:\/\/nhub.news\/fr\/wp-json\/wp\/v2\/posts\/413914\/revisions\/413915"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/nhub.news\/fr\/wp-json\/wp\/v2\/media\/413913"}],"wp:attachment":[{"href":"http:\/\/nhub.news\/fr\/wp-json\/wp\/v2\/media?parent=413914"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/nhub.news\/fr\/wp-json\/wp\/v2\/categories?post=413914"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/nhub.news\/fr\/wp-json\/wp\/v2\/tags?post=413914"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}