<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to Author's_notes</title><link>https://sourceforge.net/p/hpg-projects/wiki/Author%2527s_notes/</link><description>Recent changes to Author's_notes</description><atom:link href="https://sourceforge.net/p/hpg-projects/wiki/Author's_notes/feed" rel="self"/><language>en</language><lastBuildDate>Fri, 20 Jan 2023 12:12:45 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/hpg-projects/wiki/Author's_notes/feed" rel="self" type="application/rss+xml"/><item><title>Author's_notes modified by Hugh Greene</title><link>https://sourceforge.net/p/hpg-projects/wiki/Author%2527s_notes/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;I'll be brief, and someone can format this all nice-like later.&lt;/p&gt;
&lt;p&gt;While extending ENIGMA by adding a new API is simple and requires&lt;br/&gt;
minimal rewriting, extending it by porting to a new language (other than&lt;br/&gt;
C++) involves a total rewrite of all systems, including functions&lt;br/&gt;
defined by &lt;a class="" href="../Universal_System/" title="wikilink"&gt;Universal_System/&lt;/a&gt;, which is&lt;br/&gt;
responsible for sensitive and important key systems, such as instance&lt;br/&gt;
management. This page is a collection of notes from developers who have&lt;br/&gt;
implemented these systems; may they help you in porting to new&lt;br/&gt;
languages.&lt;/p&gt;
&lt;h2 id="instance-management"&gt;Instance Management&lt;/h2&gt;
&lt;h3 id="storage"&gt;Storage&lt;/h3&gt;
&lt;p&gt;To implement GM's random-access routines on objects by index, by id, and&lt;br/&gt;
by heritage, it is wise to store a data structure of some kind for each&lt;br/&gt;
of those. In C++, a list is kept for each object index, and a map is&lt;br/&gt;
kept for id-based access. Children of an object are added to both the&lt;br/&gt;
parent's list and the child's list.&lt;/p&gt;
&lt;h3 id="destruction"&gt;Destruction&lt;/h3&gt;
&lt;p&gt;In compiled languages, instance_destroy() is a dangerous mechanism.&lt;br/&gt;
Since it is the current instance that is being destroyed, it would be&lt;br/&gt;
folly to free concerned memory immediately upon the call to the&lt;br/&gt;
function. Instead, iterators are removed during the call, but are kept&lt;br/&gt;
valid, and maintained upon later destroys. Instances are "Garbage&lt;br/&gt;
Collected" at the end of the event, and the iterators finally removed.&lt;/p&gt;
&lt;h3 id="instantiation"&gt;Instantiation&lt;/h3&gt;
&lt;p&gt;In the C version, upon instantiation, each object adds its own iterators&lt;br/&gt;
and keeps a reference to them for when it is destroyed. The actual&lt;br/&gt;
destructor is designed to remove them.&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Hugh Greene</dc:creator><pubDate>Fri, 20 Jan 2023 12:12:45 -0000</pubDate><guid>https://sourceforge.net50d2edc9d7d3605692f86eba786fd1f369d36e76</guid></item></channel></rss>