{"id":2516,"date":"2021-09-04T18:33:50","date_gmt":"2021-09-04T13:03:50","guid":{"rendered":"https:\/\/www.rangakrish.com\/?p=2516"},"modified":"2021-09-04T18:33:50","modified_gmt":"2021-09-04T13:03:50","slug":"ring-language-dynamic-behavior-of-classes-and-objects","status":"publish","type":"post","link":"https:\/\/www.rangakrish.com\/index.php\/2021\/09\/04\/ring-language-dynamic-behavior-of-classes-and-objects\/","title":{"rendered":"Ring Language: Dynamic Behavior of Classes and Objects"},"content":{"rendered":"<p>We have been exploring the <a href=\"https:\/\/ring-lang.sourceforge.io\" target=\"_blank\" rel=\"noopener\"><em><strong>Ring Programming Language<\/strong><\/em><\/a>\u00a0in the last two <a href=\"https:\/\/www.rangakrish.com\/index.php\/2021\/08\/07\/first-encounter-with-the-ring-programming-language\/\" target=\"_blank\" rel=\"noopener\"><em><strong>articles.<\/strong><\/em><\/a>\u00a0<em><strong>Ring<\/strong><\/em> is a dynamic programming language with many interesting features. In today&#8217;s article, let us try to understand how this dynamic behavior is reflected in <em><strong>Classes<\/strong><\/em> and <em><strong>Objects<\/strong><\/em>.<\/p>\n<p>In <em><strong>Ring<\/strong><\/em>, we can define classes at <strong><em>runtime<\/em><\/strong>. One way to do this is to execute a <em><strong>&#8220;script&#8221;<\/strong><\/em>. As part of the script, we can define a class, and so when the script is executed, the class gets <em><strong>&#8220;defined&#8221;<\/strong><\/em>.<span class=\"Apple-converted-space\">\u00a0<\/span><\/p>\n<p>Look at the code fragment below:<\/p>\n<figure id=\"attachment_2517\" aria-describedby=\"caption-attachment-2517\" style=\"width: 500px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image1.jpg?ssl=1\"><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" data-attachment-id=\"2517\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2021\/09\/04\/ring-language-dynamic-behavior-of-classes-and-objects\/image1-4\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image1.jpg\" data-orig-size=\"1074,524\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Admin&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1630771231&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Dynamic Class Creation\" data-image-description=\"&lt;p&gt;Dynamic Class Creation&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Dynamic Class Creation&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image1-1024x500.jpg\" class=\"wp-image-2517\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image1.jpg?resize=500%2C244&#038;ssl=1\" alt=\"Dynamic Class Creation\" width=\"500\" height=\"244\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image1.jpg?resize=300%2C146&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image1.jpg?resize=1024%2C500&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image1.jpg?resize=768%2C375&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image1.jpg?w=1074&amp;ssl=1 1074w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/a><figcaption id=\"caption-attachment-2517\" class=\"wp-caption-text\"><strong>Dynamic Class Creation<\/strong><\/figcaption><\/figure>\n<p>When we execute this code, this is the output:<\/p>\n<figure id=\"attachment_2518\" aria-describedby=\"caption-attachment-2518\" style=\"width: 500px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image1-result.jpg?ssl=1\"><img data-recalc-dims=\"1\" decoding=\"async\" data-attachment-id=\"2518\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2021\/09\/04\/ring-language-dynamic-behavior-of-classes-and-objects\/image1-result\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image1-result.jpg\" data-orig-size=\"665,148\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Admin&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1630771254&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Output\" data-image-description=\"&lt;p&gt;Output&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Output&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image1-result.jpg\" class=\"wp-image-2518\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image1-result.jpg?resize=500%2C111&#038;ssl=1\" alt=\"Output\" width=\"500\" height=\"111\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image1-result.jpg?resize=300%2C67&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image1-result.jpg?w=665&amp;ssl=1 665w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/a><figcaption id=\"caption-attachment-2518\" class=\"wp-caption-text\"><strong>Output<\/strong><\/figcaption><\/figure>\n<p>Being able to define classes at runtime is definitely interesting. What happens if we <em><strong>redefine<\/strong><\/em> this class, say, with a different structure?<\/p>\n<figure id=\"attachment_2519\" aria-describedby=\"caption-attachment-2519\" style=\"width: 500px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image2.jpg?ssl=1\"><img data-recalc-dims=\"1\" decoding=\"async\" data-attachment-id=\"2519\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2021\/09\/04\/ring-language-dynamic-behavior-of-classes-and-objects\/image2-4\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image2.jpg\" data-orig-size=\"1169,378\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Admin&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1630771417&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Class Redefinition\" data-image-description=\"&lt;p&gt;Class Redefinition&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Class Redefinition&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image2-1024x331.jpg\" class=\"wp-image-2519\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image2.jpg?resize=500%2C162&#038;ssl=1\" alt=\"Class Redefinition\" width=\"500\" height=\"162\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image2.jpg?resize=300%2C97&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image2.jpg?resize=1024%2C331&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image2.jpg?resize=768%2C248&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image2.jpg?w=1169&amp;ssl=1 1169w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/a><figcaption id=\"caption-attachment-2519\" class=\"wp-caption-text\"><strong>Class Redefinition<\/strong><\/figcaption><\/figure>\n<p>That is not allowed! This results in an error at runtime:<\/p>\n<figure id=\"attachment_2520\" aria-describedby=\"caption-attachment-2520\" style=\"width: 500px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image2-result.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"2520\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2021\/09\/04\/ring-language-dynamic-behavior-of-classes-and-objects\/image2-result\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image2-result.jpg\" data-orig-size=\"1165,184\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Admin&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1630771447&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Redefinition Not Allowed\" data-image-description=\"&lt;p&gt;Redefinition Not Allowed&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Redefinition Not Allowed&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image2-result-1024x162.jpg\" class=\"wp-image-2520\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image2-result.jpg?resize=500%2C79&#038;ssl=1\" alt=\"Redefinition Not Allowed\" width=\"500\" height=\"79\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image2-result.jpg?resize=300%2C47&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image2-result.jpg?resize=1024%2C162&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image2-result.jpg?resize=768%2C121&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image2-result.jpg?w=1165&amp;ssl=1 1165w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/a><figcaption id=\"caption-attachment-2520\" class=\"wp-caption-text\"><strong>Redefinition Not Allowed<\/strong><\/figcaption><\/figure>\n<p>Next, let us dynamically define another class that has a single method, and then invoke that method:<\/p>\n<figure id=\"attachment_2521\" aria-describedby=\"caption-attachment-2521\" style=\"width: 500px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image3.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"2521\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2021\/09\/04\/ring-language-dynamic-behavior-of-classes-and-objects\/image3-5\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image3.jpg\" data-orig-size=\"1210,409\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Admin&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1630771742&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Another Class Dynamically Created\" data-image-description=\"&lt;p&gt;Another Class Dynamically Created&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Another Class Dynamically Created&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image3-1024x346.jpg\" class=\"wp-image-2521\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image3.jpg?resize=500%2C169&#038;ssl=1\" alt=\"Another Class Dynamically Created\" width=\"500\" height=\"169\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image3.jpg?resize=300%2C101&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image3.jpg?resize=1024%2C346&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image3.jpg?resize=768%2C260&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image3.jpg?w=1210&amp;ssl=1 1210w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/a><figcaption id=\"caption-attachment-2521\" class=\"wp-caption-text\"><strong>Another Class Dynamically Created<\/strong><\/figcaption><\/figure>\n<p>Here is the output:<\/p>\n<figure id=\"attachment_2522\" aria-describedby=\"caption-attachment-2522\" style=\"width: 500px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image3-result.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"2522\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2021\/09\/04\/ring-language-dynamic-behavior-of-classes-and-objects\/image3-result\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image3-result.jpg\" data-orig-size=\"1055,110\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Admin&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1630771773&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Invoking Method Dynamically\" data-image-description=\"&lt;p&gt;Invoking Method Dynamically&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Invoking Method Dynamically&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image3-result-1024x107.jpg\" class=\"wp-image-2522\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image3-result.jpg?resize=500%2C52&#038;ssl=1\" alt=\"Invoking Method Dynamically\" width=\"500\" height=\"52\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image3-result.jpg?resize=300%2C31&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image3-result.jpg?resize=1024%2C107&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image3-result.jpg?resize=768%2C80&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image3-result.jpg?w=1055&amp;ssl=1 1055w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/a><figcaption id=\"caption-attachment-2522\" class=\"wp-caption-text\"><strong>Invoking Method Dynamically<\/strong><\/figcaption><\/figure>\n<p>What if we try to invoke a method that is not defined in the class?<\/p>\n<figure id=\"attachment_2523\" aria-describedby=\"caption-attachment-2523\" style=\"width: 500px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image4.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"2523\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2021\/09\/04\/ring-language-dynamic-behavior-of-classes-and-objects\/image4-5\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image4.jpg\" data-orig-size=\"1140,297\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Admin&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1630771910&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Invoking an Undefined Method\" data-image-description=\"&lt;p&gt;Invoking an Undefined Method&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Invoking an Undefined Method&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image4-1024x267.jpg\" class=\"wp-image-2523\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image4.jpg?resize=500%2C130&#038;ssl=1\" alt=\"Invoking an Undefined Method\" width=\"500\" height=\"130\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image4.jpg?resize=300%2C78&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image4.jpg?resize=1024%2C267&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image4.jpg?resize=768%2C200&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image4.jpg?w=1140&amp;ssl=1 1140w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/a><figcaption id=\"caption-attachment-2523\" class=\"wp-caption-text\"><strong>Invoking an Undefined Method<\/strong><\/figcaption><\/figure>\n<p>Here is the runtime error:<\/p>\n<figure id=\"attachment_2524\" aria-describedby=\"caption-attachment-2524\" style=\"width: 500px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image4-result.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"2524\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2021\/09\/04\/ring-language-dynamic-behavior-of-classes-and-objects\/image4-result\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image4-result.jpg\" data-orig-size=\"986,80\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Admin&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1630771944&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Undefined Method Error\" data-image-description=\"&lt;p&gt;Undefined Method Error&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Undefined Method Error&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image4-result.jpg\" class=\"wp-image-2524\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image4-result.jpg?resize=500%2C41&#038;ssl=1\" alt=\"Undefined Method Error\" width=\"500\" height=\"41\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image4-result.jpg?resize=300%2C24&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image4-result.jpg?resize=768%2C62&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image4-result.jpg?w=986&amp;ssl=1 986w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/a><figcaption id=\"caption-attachment-2524\" class=\"wp-caption-text\"><strong>Undefined Method Error<\/strong><\/figcaption><\/figure>\n<p>This is along expected lines.<\/p>\n<h3>Reflection<span class=\"Apple-converted-space\">\u00a0<\/span><\/h3>\n<p><em><strong>Ring<\/strong><\/em> has an interesting <em><strong>&#8220;Reflection&#8221;<\/strong><\/em> API. I am going to touch upon just three functions today. For more information, you can go through this <a href=\"https:\/\/ring-lang.sourceforge.io\/doc1.14\/metaprog.html\" target=\"_blank\" rel=\"noopener\"><em><strong>article<\/strong><\/em><\/a>.<\/p>\n<p>The first function we will consider is <em><strong>&#8220;methods()&#8221;<\/strong><\/em>. Given an object as argument, this function returns a list of methods supported by the object. We can then invoke the <em><strong>&#8220;discovered&#8221;<\/strong><\/em> methods.<\/p>\n<figure id=\"attachment_2526\" aria-describedby=\"caption-attachment-2526\" style=\"width: 500px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image5.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"2526\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2021\/09\/04\/ring-language-dynamic-behavior-of-classes-and-objects\/image5-4\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image5.jpg\" data-orig-size=\"1144,376\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Admin&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1630773107&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Discovering Methods at Runtime\" data-image-description=\"&lt;p&gt;Discovering Methods at Runtime&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Discovering Methods at Runtime&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image5-1024x337.jpg\" class=\"wp-image-2526\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image5.jpg?resize=500%2C164&#038;ssl=1\" alt=\"Discovering Methods at Runtime\" width=\"500\" height=\"164\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image5.jpg?resize=300%2C99&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image5.jpg?resize=1024%2C337&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image5.jpg?resize=768%2C252&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image5.jpg?w=1144&amp;ssl=1 1144w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/a><figcaption id=\"caption-attachment-2526\" class=\"wp-caption-text\"><strong>Discovering Methods at Runtime<\/strong><\/figcaption><\/figure>\n<p>This is the output:<\/p>\n<figure id=\"attachment_2527\" aria-describedby=\"caption-attachment-2527\" style=\"width: 500px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image5-result.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"2527\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2021\/09\/04\/ring-language-dynamic-behavior-of-classes-and-objects\/image5-result\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image5-result.jpg\" data-orig-size=\"894,111\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Admin&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1630773152&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Invoking the Discovered Method\" data-image-description=\"&lt;p&gt;Invoking the Discovered Method&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Invoking the Discovered Method&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image5-result.jpg\" class=\"wp-image-2527\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image5-result.jpg?resize=500%2C62&#038;ssl=1\" alt=\"Invoking the Discovered Method\" width=\"500\" height=\"62\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image5-result.jpg?resize=300%2C37&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image5-result.jpg?resize=768%2C95&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image5-result.jpg?w=894&amp;ssl=1 894w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/a><figcaption id=\"caption-attachment-2527\" class=\"wp-caption-text\"><strong>Invoking the Discovered Method<\/strong><\/figcaption><\/figure>\n<p>No surprise here.<\/p>\n<p>Next, using the <em><strong>&#8220;addmethod()&#8221;<\/strong><\/em> function, we can add a new method to an object. Likewise, there is an <em><strong>&#8220;addattribute()&#8221;<\/strong><\/em> function to add an attribute to an object:<\/p>\n<figure id=\"attachment_2528\" aria-describedby=\"caption-attachment-2528\" style=\"width: 500px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image6.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"2528\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2021\/09\/04\/ring-language-dynamic-behavior-of-classes-and-objects\/image6-4\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image6.jpg\" data-orig-size=\"1195,487\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Admin&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1630777678&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Reflection API Example\" data-image-description=\"&lt;p&gt;Reflection API Example&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Reflection API Example&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image6-1024x417.jpg\" class=\"wp-image-2528\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image6.jpg?resize=500%2C204&#038;ssl=1\" alt=\"Reflection API Example\" width=\"500\" height=\"204\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image6.jpg?resize=300%2C122&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image6.jpg?resize=1024%2C417&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image6.jpg?resize=768%2C313&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image6.jpg?w=1195&amp;ssl=1 1195w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/a><figcaption id=\"caption-attachment-2528\" class=\"wp-caption-text\"><strong>Reflection API Example<\/strong><\/figcaption><\/figure>\n<p>And the output is:<\/p>\n<figure id=\"attachment_2529\" aria-describedby=\"caption-attachment-2529\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image6-result.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"2529\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2021\/09\/04\/ring-language-dynamic-behavior-of-classes-and-objects\/image6-result\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image6-result.jpg\" data-orig-size=\"400,76\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Admin&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1630777780&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"The Output\" data-image-description=\"&lt;p&gt;The Output&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;The Output&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image6-result.jpg\" class=\"size-medium wp-image-2529\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image6-result.jpg?resize=300%2C57&#038;ssl=1\" alt=\"The Output\" width=\"300\" height=\"57\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image6-result.jpg?resize=300%2C57&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image6-result.jpg?w=400&amp;ssl=1 400w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-2529\" class=\"wp-caption-text\"><strong>The Output<\/strong><\/figcaption><\/figure>\n<p>What is peculiar and important to keep in mind is that<span class=\"Apple-converted-space\">\u00a0 <\/span>we are <span style=\"text-decoration: underline;\"><em><strong>not<\/strong><\/em><\/span>\u00a0adding the method and attribute to the <em><strong>&#8220;DynamicClass2&#8221;<\/strong><\/em> class, but only to a single instance of that class. This implies that if we create another object of this class and try to access the method or attribute that we just now added to the other object, we will get an error!<\/p>\n<p>Here is a code fragment that shows this:<\/p>\n<figure id=\"attachment_2530\" aria-describedby=\"caption-attachment-2530\" style=\"width: 500px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image7.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"2530\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2021\/09\/04\/ring-language-dynamic-behavior-of-classes-and-objects\/image7-3\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image7.jpg\" data-orig-size=\"1159,370\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Admin&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1630778030&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Changes are Object-Specific\" data-image-description=\"&lt;p&gt;Changes are Object-Specific&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Changes are Object-Specific&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image7-1024x327.jpg\" class=\"wp-image-2530\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image7.jpg?resize=500%2C160&#038;ssl=1\" alt=\"Changes are Object-Specific\" width=\"500\" height=\"160\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image7.jpg?resize=300%2C96&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image7.jpg?resize=1024%2C327&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image7.jpg?resize=768%2C245&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image7.jpg?w=1159&amp;ssl=1 1159w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/a><figcaption id=\"caption-attachment-2530\" class=\"wp-caption-text\"><em><strong>Changes are Object-Specific<\/strong><\/em><\/figcaption><\/figure>\n<p>Here is the corresponding output:<\/p>\n<figure id=\"attachment_2531\" aria-describedby=\"caption-attachment-2531\" style=\"width: 500px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image7-result.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"2531\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2021\/09\/04\/ring-language-dynamic-behavior-of-classes-and-objects\/image7-result\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image7-result.jpg\" data-orig-size=\"1173,122\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Admin&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1630778058&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"This is the Proof\" data-image-description=\"&lt;p&gt;This is the Proof&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;This is the Proof&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image7-result-1024x107.jpg\" class=\"wp-image-2531\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image7-result.jpg?resize=500%2C52&#038;ssl=1\" alt=\"This is the Proof\" width=\"500\" height=\"52\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image7-result.jpg?resize=300%2C31&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image7-result.jpg?resize=1024%2C107&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image7-result.jpg?resize=768%2C80&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/09\/image7-result.jpg?w=1173&amp;ssl=1 1173w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/a><figcaption id=\"caption-attachment-2531\" class=\"wp-caption-text\"><strong>Error When Accessing Attribute<\/strong><\/figcaption><\/figure>\n<p>It is clear that <em><strong>Ring<\/strong><\/em> differs from other popular languages in the way <em><strong>Classes<\/strong><\/em> and <em><strong>Objects<\/strong><\/em> are handled.<span class=\"Apple-converted-space\">\u00a0<\/span><\/p>\n<p>We will continue to explore other features of <em><strong>Ring<\/strong><\/em> in future articles. Here is the <a href=\"http:\/\/www.rangakrish.com\/downloads\/DynamicClass.ring\" target=\"_blank\" rel=\"noopener\"><em><strong>code<\/strong><\/em><\/a>\u00a0used in today&#8217;s article.<\/p>\n<p>Have a nice weekend!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We have been exploring the Ring Programming Language\u00a0in the last two articles.\u00a0Ring is a dynamic programming language with many interesting features. In today&#8217;s article, let us try to understand how this dynamic behavior is reflected in Classes and Objects. In Ring, we can define classes at runtime. One way to do this is to execute [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[17,289],"tags":[292,291,288],"class_list":["post-2516","post","type-post","status-publish","format-standard","hentry","category-programming","category-ring-language","tag-object-orientation","tag-reflection-api","tag-ring-programming-language"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9OLnF-EA","jetpack-related-posts":[{"id":2496,"url":"https:\/\/www.rangakrish.com\/index.php\/2021\/08\/07\/first-encounter-with-the-ring-programming-language\/","url_meta":{"origin":2516,"position":0},"title":"First Encounter with the Ring Programming Language","author":"admin","date":"August 7, 2021","format":false,"excerpt":"The Ring Programming Language, designed by Mahmoud Fayed,\u00a0 has been around since 2016. I came to know of it quite accidentally two weeks ago when I received a promotional email from Apress about their book \"Beginning Ring Programming\" by Mansour Ayouni, published in 2020. I immediately did a google search\u2026","rel":"","context":"In &quot;C++&quot;","block_context":{"text":"C++","link":"https:\/\/www.rangakrish.com\/index.php\/category\/c\/"},"img":{"alt_text":"Ring Installation Directory","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/08\/directory-300x155.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":3350,"url":"https:\/\/www.rangakrish.com\/index.php\/2024\/03\/09\/the-hy-programming-language-part-2\/","url_meta":{"origin":2516,"position":1},"title":"The Hy Programming Language &#8211; Part 2","author":"admin","date":"March 9, 2024","format":false,"excerpt":"I wrote about \u201cHy\u201d language in an earlier article. Since then I have been exploring the language some more, trying to get a better understanding of its features.\u00a0 The following example uses inheritance to model different types of \u201cSpace\u201d objects such as Asteroid, SpaceShip and Planet. It is taken from\u2026","rel":"","context":"In &quot;Hy Language&quot;","block_context":{"text":"Hy Language","link":"https:\/\/www.rangakrish.com\/index.php\/category\/hy-language\/"},"img":{"alt_text":"Inheritance Example","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/03\/Inheritance-Example-201x300.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/03\/Inheritance-Example-201x300.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/03\/Inheritance-Example-201x300.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":2506,"url":"https:\/\/www.rangakrish.com\/index.php\/2021\/08\/21\/loop-command-in-ring-programming-language\/","url_meta":{"origin":2516,"position":2},"title":"&#8220;Loop&#8221; Command in Ring Programming Language","author":"admin","date":"August 21, 2021","format":false,"excerpt":"In my last article, I had written about how easy it is to execute Ring code from within C\/C++. Today's article takes a look at the \"Loop\" command. This command is very similar to \"continue\" in many languages such as C++, Java, Python. etc. It is used to skip the\u2026","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/www.rangakrish.com\/index.php\/category\/programming\/"},"img":{"alt_text":"\"Continue\" in Java","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/08\/javacode-300x183.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":3153,"url":"https:\/\/www.rangakrish.com\/index.php\/2023\/07\/02\/the-sum-type-in-v-programming-language\/","url_meta":{"origin":2516,"position":3},"title":"The Sum Type in V Programming Language","author":"admin","date":"July 2, 2023","format":false,"excerpt":"A Sum data type in V language gives us a convenient way to hold objects of many distinct types (at any time, just one object) and hence is a discriminated union. For example, in C++ we have the variant type. Here is an example of sum type in V language:\u2026","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/www.rangakrish.com\/index.php\/category\/programming\/"},"img":{"alt_text":"The \"sum\" Type","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2023\/07\/example1-300x187.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2023\/07\/example1-300x187.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2023\/07\/example1-300x187.jpg?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":2668,"url":"https:\/\/www.rangakrish.com\/index.php\/2022\/01\/23\/template-mixins-in-d-programming-language\/","url_meta":{"origin":2516,"position":4},"title":"Template Mixins in D Programming Language","author":"admin","date":"January 23, 2022","format":false,"excerpt":"When I heard the name Mixin\u00a0for the first time in the context of Dlang, I imagined it would be something similar to the mixins\u00a0of Common Lisp, but I was completely wrong!\u00a0 Mixins are a very interesting feature of D language. They allow code to be \"injected\" into the source at\u2026","rel":"","context":"In &quot;D Language&quot;","block_context":{"text":"D Language","link":"https:\/\/www.rangakrish.com\/index.php\/category\/d-language\/"},"img":{"alt_text":"Simple Template Mixin","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/01\/Defn-300x98.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":4012,"url":"https:\/\/www.rangakrish.com\/index.php\/2026\/01\/01\/common-lisp-metaobject-protocol-classes-are-just-objects\/","url_meta":{"origin":2516,"position":5},"title":"Common Lisp Metaobject Protocol: Classes are Just Objects!","author":"admin","date":"January 1, 2026","format":false,"excerpt":"In today\u2019s popular languages such as C++, Java, Golang, Rust, Python, etc., classes are fixed constructs defined by the language. They have a definite syntax that can\u2019t be changed while programming. We are all used to this of course. But what makes Common Lisp stand out is that in that\u2026","rel":"","context":"In &quot;LISP&quot;","block_context":{"text":"LISP","link":"https:\/\/www.rangakrish.com\/index.php\/category\/lisp\/"},"img":{"alt_text":"A Simple Class","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/01\/code1-300x42.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts\/2516","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/comments?post=2516"}],"version-history":[{"count":0,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts\/2516\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/media?parent=2516"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/categories?post=2516"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/tags?post=2516"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}