{"id":102693,"date":"2019-07-15T07:00:00","date_gmt":"2019-07-15T14:00:00","guid":{"rendered":"http:\/\/devblogs.microsoft.com\/oldnewthing\/?p=102693"},"modified":"2019-07-31T06:09:45","modified_gmt":"2019-07-31T13:09:45","slug":"20190715-00","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20190715-00\/?p=102693","title":{"rendered":"My initial confusion when encountering functions whose names begin with <CODE>Co<\/CODE>"},"content":{"rendered":"<p>My formal education is in mathematics. In this highly abstract world, you spend a lot of time working with various types of duality and dual spaces. In general terms, a dual of a concept X is a special type of function (a <i>homomorphism<\/i>) that takes an X and produces a scalar. The convention in mathematics for dual spaces is that the <i>co-<\/i> prefix denotes the dual.<\/p>\n<p>For example, in linear algebra, the dual of a <i>vector<\/i> is a <i>covector<\/i>: A <i>covector<\/i> is a special kind of function (<i>linear operator<\/i>) that operates on vectors. (If you&#8217;re an engineer, then a vector is a column of numbers, and a covector is a row of numbers, with function application being the usual matrix product.)<\/p>\n<p>In Windows, COM functions generally begin with the prefix <code>Co-<\/code>: <code>Co\u00adInitialize<\/code>, <code>Co\u00adCreate\u00adInstance<\/code>, <code>Co\u00adRegister\u00adClassObject<\/code>. The <code>Co-<\/code> prefix is just a namespace disambiguator, just like how shell functions begin with <code>SH-<\/code> and native system services begin with <code>Zw-<\/code> (which <a href=\"https:\/\/docs.microsoft.com\/windows-hardware\/drivers\/kernel\/what-does-the-zw-prefix-mean-\"> doesn&#8217;t stand for anything<\/a>).<\/p>\n<p>The first time I encountered these COM functions, it was in a meeting, when somebody said something like, &#8220;You need to call <code>Co\u00adCreate\u00adInstance<\/code> with\u2026&#8221; I came from a world where the <i>co-<\/i> prefix represented mathematical duality, so I assumed that this mysterious function somehow created a dual object. You took this dual object, applied it to another object, and out came a number! I then spent some time trying to figure out what this dual object could look like, and how it could be useful.<\/p>\n<p>But of course it wasn&#8217;t any such thing. It was just &#8220;create an instance of an object.&#8221;<\/p>\n<p>Today is the first day of the 2019 International Mathematical Olympiad.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We aren&#8217;t in the math department any more.<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[26],"class_list":["post-102693","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-other"],"acf":[],"blog_post_summary":"<p>We aren&#8217;t in the math department any more.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/102693","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=102693"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/102693\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=102693"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=102693"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=102693"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}