{"id":1223,"date":"2017-05-18T21:30:12","date_gmt":"2017-05-18T21:30:12","guid":{"rendered":"http:\/\/sdi.thoughtstorms.info\/?p=1223"},"modified":"2017-05-18T21:30:12","modified_gmt":"2017-05-18T21:30:12","slug":"whats-wrong-with-c","status":"publish","type":"post","link":"https:\/\/sdi.thoughtstorms.info\/?p=1223","title":{"rendered":"What&#039;s wrong with C++?"},"content":{"rendered":"<p>Another Quora answer : <em><a href=\"https:\/\/www.quora.com\/Why-is-C++-considered-a-bad-language\/answer\/Phil-Jones\">Phil Jones&#8217;s answer to Why is C++ considered a bad language?<\/a><\/em><br \/>\nThis is one of those rare occasions I disagree with <a href=\"https:\/\/www.quora.com\/profile\/Simon-Kinahan\">Simon Kinahan<\/a>; although his answer sets the scene for this one.<br \/>\n<em>[Simon says that C++ isn&#8217;t a bad language. It&#8217;s the right choice if you need low-level memory control and the ability to build powerful higher-level abstractions.]<\/em><br \/>\nC++ is a bad language because it\u2019s built on a flawed philosophy : which is that you should add power to a language by kludging it in \u201chorizontally\u201d in the form of libraries rather than \u201cvertically\u201d by building new Domain Specific Languages to express it.<br \/>\nStroustrup is very explicit about this, rhetorically asking \u201cwhy go to other languages for new features when you can add them as libraries in C++?\u201d<br \/>\nWell, the answer is, adding new higher level conceptual thinking in the form of a library doesn\u2019t really hide the old thinking from you. Or allow you to abandon it.<br \/>\nC++\u2019s abstractions leak, <i>more or less on purpose<\/i>. Because you can never escape the underlying low-level thinking when you\u2019re just using this stuff via libraries. You are stuck with the syntax and mindset of the low-level, even as you add more and more frameworks on top.<br \/>\nYes, you can explicitly add garbage collection to a C++ program. But you can\u2019t relax and stop thinking about memory management. It can\u2019t disappear completely beneath the horizon of things you need to be aware of the way it does in Java.<br \/>\nYes, you can have higher-level strings, that can abstract Unicode-ness etc. via a library. But you can never be sure that you won\u2019t confront strings that are simple byte-arrays coming from another part of your large system.<br \/>\nEtc.<br \/>\nC++\u2019s ability to build high-level abstractions uncomfortably falls between two stools.<br \/>\nIt encourage you to think you can and should be building large applications full of application logic. But doesn\u2019t give you the real abstracting power to focus only at that application level.<br \/>\nThis explains the otherwise mysterious paradox that C <i>is<\/i> a good language, so how could something that is \u201cC plus more stuff\u201d possibly be a bad one? Well, it\u2019s exactly the \u201cmore plussing\u201d that\u2019s the problem.<br \/>\nWith C, you KNOW you should only use it to build relatively small things. It doesn\u2019t pretend to offer you mechanisms to build big things. And so you turn to the obvious tools for scaling up : lex and yacc to build small scripting languages, the Unix pipe to orchestrate multiple small tools . C++ gives you just enough rope to hang yourself. Just enough powerful abstraction building capacity in the language itself that you (or that guy who used to work in your company 15 years ago ) thought it might be possible to reinvent half of Common Lisp\u2019s data-manipulation <a href=\"https:\/\/en.wikipedia.org\/wiki\/Greenspun%27s_tenth_rule\">capability<\/a> and half an operating systems\u2019 worth of concurrent process management <i>inside<\/i> your sprawling monolithic application.<br \/>\nI don\u2019t see why it shouldn\u2019t be possible to combine low-level memory management and efficiency with high level abstraction building. But proper abstraction building requires something more like macros or similar capabilities to make a level of expression which really transcends the low level. That\u2019s exactly what C++ lacks.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Another Quora answer : Phil Jones&#8217;s answer to Why is C++ considered a bad language? This is one of those rare occasions I disagree with Simon Kinahan; although his answer sets the scene for this one. [Simon says that C++ isn&#8217;t a bad language. It&#8217;s the right choice if you need low-level memory control and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[53,118,240,246],"class_list":["post-1223","post","type-post","status-publish","format-standard","hentry","category-opinion","tag-c","tag-dsl","tag-language-oriented-programming","tag-libraries"],"_links":{"self":[{"href":"https:\/\/sdi.thoughtstorms.info\/index.php?rest_route=\/wp\/v2\/posts\/1223","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sdi.thoughtstorms.info\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sdi.thoughtstorms.info\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sdi.thoughtstorms.info\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sdi.thoughtstorms.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1223"}],"version-history":[{"count":0,"href":"https:\/\/sdi.thoughtstorms.info\/index.php?rest_route=\/wp\/v2\/posts\/1223\/revisions"}],"wp:attachment":[{"href":"https:\/\/sdi.thoughtstorms.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1223"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sdi.thoughtstorms.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1223"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sdi.thoughtstorms.info\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1223"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}