<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>dispatch-table on Mature Pessimizations - A programming blog by Theodoros Chatzigiannakis</title>
    <link>https://blog.tchatzigiannakis.com/tags/dispatch-table/</link>
    <description>Recent content in dispatch-table on Mature Pessimizations - A programming blog by Theodoros Chatzigiannakis</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <lastBuildDate>Mon, 21 Aug 2017 20:00:00 +0300</lastBuildDate>
    
	<atom:link href="https://blog.tchatzigiannakis.com/tags/dispatch-table/index.xml" rel="self" type="application/rss+xml" />
    
    
    <item>
      <title>Changing an object&#39;s type at runtime in C#</title>
      <link>https://blog.tchatzigiannakis.com/changing-an-objects-type-at-runtime-in-c-sharp/</link>
      <pubDate>Mon, 21 Aug 2017 20:00:00 +0300</pubDate>
      
      <guid>https://blog.tchatzigiannakis.com/changing-an-objects-type-at-runtime-in-c-sharp/</guid>
      <description>&lt;p&gt;In most statically typed languages, an object&amp;rsquo;s type is set in stone once the object has been completely constructed. While the object can subsequently be cast to various types, it can never change its runtime type — many aspects of type systems and features (such as virtual dispatch) depend on this.&lt;/p&gt;

&lt;p&gt;In this post, we will see how we can use unsafe code in C# to bypass the type system and change a .NET object&amp;rsquo;s runtime type. Then, we will see an unusual case where it would be neat to have this. Needless to say, don&amp;rsquo;t try this in real code.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Implementing multiple dispatch polymorphism</title>
      <link>https://blog.tchatzigiannakis.com/implementing-multiple-dispatch-polymorphism/</link>
      <pubDate>Wed, 15 Mar 2017 20:00:00 +0300</pubDate>
      
      <guid>https://blog.tchatzigiannakis.com/implementing-multiple-dispatch-polymorphism/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;https://blog.tchatzigiannakis.com/implementing-single-dispatch-polymorphism/&#34;&gt;As we saw previously&lt;/a&gt;, many popular OOP languages support subtype polymorphism with single dispatch. This means that the dynamic resolution of a polymorphic call happens with respect to one argument only: the &lt;code&gt;this&lt;/code&gt; reference.&lt;/p&gt;

&lt;p&gt;The problem with this limitation is that it&amp;rsquo;s completely arbitrary. In a well-written program, there is no natural tendency for polymorphism to be useful only in one dimension. Quite the contrary – if a program is written with best OOP practices in mind (e.g. &lt;a href=&#34;https://en.wikipedia.org/wiki/Single_responsibility_principle&#34;&gt;one responsibility per class&lt;/a&gt;), chances are that the need for multidimensional polymorphism, also called &lt;em&gt;multiple dispatch&lt;/em&gt;, will eventually arise.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Implementing multiple dispatch polymorphism</title>
      <link>https://blog.tchatzigiannakis.com/implementing-multiple-dispatch-polymorphism/</link>
      <pubDate>Wed, 15 Mar 2017 20:00:00 +0300</pubDate>
      
      <guid>https://blog.tchatzigiannakis.com/implementing-multiple-dispatch-polymorphism/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;https://blog.tchatzigiannakis.com/implementing-single-dispatch-polymorphism/&#34;&gt;As we saw previously&lt;/a&gt;, many popular OOP languages support subtype polymorphism with single dispatch. This means that the dynamic resolution of a polymorphic call happens with respect to one argument only: the &lt;code&gt;this&lt;/code&gt; reference.&lt;/p&gt;

&lt;p&gt;The problem with this limitation is that it&amp;rsquo;s completely arbitrary. In a well-written program, there is no natural tendency for polymorphism to be useful only in one dimension. Quite the contrary – if a program is written with best OOP practices in mind (e.g. &lt;a href=&#34;https://en.wikipedia.org/wiki/Single_responsibility_principle&#34;&gt;one responsibility per class&lt;/a&gt;), chances are that the need for multidimensional polymorphism, also called &lt;em&gt;multiple dispatch&lt;/em&gt;, will eventually arise.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Implementing single dispatch polymorphism</title>
      <link>https://blog.tchatzigiannakis.com/implementing-single-dispatch-polymorphism/</link>
      <pubDate>Wed, 15 Mar 2017 20:00:00 +0300</pubDate>
      
      <guid>https://blog.tchatzigiannakis.com/implementing-single-dispatch-polymorphism/</guid>
      <description>&lt;p&gt;Many object-oriented languages have support for subtype polymorphism with single dispatch over the &lt;code&gt;this&lt;/code&gt; argument.&lt;/p&gt;

&lt;p&gt;To implement polymorphic calls, they need a way of accessing information about which override should be selected at runtime. At least for compiled languages, the most obvious way to store this information is in the form of function pointers. The structure that contains these function pointers is called a &lt;em&gt;dispatch table&lt;/em&gt;.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Implementing single dispatch polymorphism</title>
      <link>https://blog.tchatzigiannakis.com/implementing-single-dispatch-polymorphism/</link>
      <pubDate>Wed, 15 Mar 2017 20:00:00 +0300</pubDate>
      
      <guid>https://blog.tchatzigiannakis.com/implementing-single-dispatch-polymorphism/</guid>
      <description>&lt;p&gt;Many object-oriented languages have support for subtype polymorphism with single dispatch over the &lt;code&gt;this&lt;/code&gt; argument.&lt;/p&gt;

&lt;p&gt;To implement polymorphic calls, they need a way of accessing information about which override should be selected at runtime. At least for compiled languages, the most obvious way to store this information is in the form of function pointers. The structure that contains these function pointers is called a &lt;em&gt;dispatch table&lt;/em&gt;.&lt;/p&gt;</description>
    </item>
    
  </channel>
</rss>