{"id":10926,"date":"2015-04-01T20:22:19","date_gmt":"2015-04-02T00:22:19","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=10926"},"modified":"2015-04-01T20:22:19","modified_gmt":"2015-04-02T00:22:19","slug":"why-overload-operators","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2015\/04\/01\/why-overload-operators\/","title":{"rendered":"Why Overload Operators?"},"content":{"rendered":"<p><a href=\"http:\/\/blog.metaobject.com\/2015\/03\/why-overload-operators.html\">Marcel Weiher<\/a>:<\/p>\n<blockquote cite=\"http:\/\/blog.metaobject.com\/2015\/03\/why-overload-operators.html\"><p>There are two candidates for what the difference might be: the fact that the operation is now written in infix notation and that it&rsquo;s using special characters.<\/p><p>[&#8230;]<\/p><p>To my eyes at least, the binary-message version is no improvement over the keyword message, in fact it seems somewhat worse to me. So the attractiveness of infix notation appears to be a strong candidate for why operator overloading is desirable. Of course, having to use operator overloading to get infix notation is problematic, because special characters generally do not convey the meaning of the operation nearly as well as names, conventional arithmetic aside.<\/p><p>[&#8230;]<\/p><p>I&rsquo;d say that overloaded operators are particularly attractive (to hacker mentalities, but that&rsquo;s probably most of us) in languages where this boundary between user-defined and built-in stuff exists, and therefore those overloaded operators let you cross that boundary and do things normally reserved for language implementors.<\/p><\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Marcel Weiher: There are two candidates for what the difference might be: the fact that the operation is now written in infix notation and that it&rsquo;s using special characters.[&#8230;]To my eyes at least, the binary-message version is no improvement over the keyword message, in fact it seems somewhat worse to me. So the attractiveness of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"","apple_news_api_id":"","apple_news_api_modified_at":"","apple_news_api_revision":"","apple_news_api_share_url":"","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[326,361,46,54,71,548,515,901],"class_list":["post-10926","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-c-plus-plus","tag-haskell","tag-languagedesign","tag-objective-c","tag-programming","tag-scala","tag-smalltalk","tag-swift-programming-language"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/10926","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=10926"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/10926\/revisions"}],"predecessor-version":[{"id":10927,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/10926\/revisions\/10927"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=10926"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=10926"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=10926"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}