<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to ENIGMA:Specification</title><link>https://sourceforge.net/p/hpg-projects/wiki/ENIGMA%253ASpecification/</link><description>Recent changes to ENIGMA:Specification</description><atom:link href="https://sourceforge.net/p/hpg-projects/wiki/ENIGMA:Specification/feed" rel="self"/><language>en</language><lastBuildDate>Fri, 20 Jan 2023 12:15:22 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/hpg-projects/wiki/ENIGMA:Specification/feed" rel="self" type="application/rss+xml"/><item><title>ENIGMA:Specification modified by Hugh Greene</title><link>https://sourceforge.net/p/hpg-projects/wiki/ENIGMA%253ASpecification/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;We are not ISO; we'll be brief. We don't believe in 1,200 page&lt;br/&gt;
specifications, especially since in this day and age, EDL is not the&lt;br/&gt;
first language of its kind and in fact borrows from a lot of other&lt;br/&gt;
languages.&lt;/p&gt;
&lt;p&gt;If ENIGMA isn't actually following the specification here, but you would&lt;br/&gt;
like it to, please let is know. This specification is part plan, part&lt;br/&gt;
fact of life.&lt;/p&gt;
&lt;h1 id="variables"&gt;Variables&lt;/h1&gt;
&lt;p&gt;Variables in EDL begin with a letter as defined in the Unicode standard.&lt;br/&gt;
To be brief, this includes a-z and A-Z. Letters after the first letter&lt;br/&gt;
may be any word character as defined in the Unicode standard, which&lt;br/&gt;
includes all letter characters and all number characters.&lt;/p&gt;
&lt;h1 id="numerals"&gt;Numerals&lt;/h1&gt;
&lt;p&gt;Numerals in ENIGMA are not common in other languages. Decimal literals&lt;br/&gt;
are denoted per C++ specification, except they may be preceded by zeros.&lt;br/&gt;
For compatibility with similar languages, the dollar sign may be used to&lt;br/&gt;
denote a hexadecimal literal. To improve on numeric support, the&lt;br/&gt;
prefixes 0x, 0o, and 0b may be used to denote hexadecimal, octal, and&lt;br/&gt;
binary literals, respectively.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;  a = 135790; // Decimal literal
  b = 013579; // Decimal literal
  c = $DECAFF; // Hex literal
  d = 0xBADF00D; // Hex literal
  e = 0o12345670; // Octal literal
  f = 0b00011011; // Binary literal
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h1 id="classes"&gt;Classes&lt;/h1&gt;
&lt;p&gt;EDL breaks from C++ for class definitions. The point of classes in&lt;br/&gt;
ENIGMA is to behave like structures in C, and so the struct keyword is&lt;br/&gt;
adopted to denote them. This decision was made for two simple reasons:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;In C and C++, structures are public while classes are private.&lt;br/&gt;
    Classes are protected or private in most languages which support&lt;br/&gt;
    visibility.&lt;/li&gt;
&lt;li&gt;The odds of a user attempting to use the word 'class' as an&lt;br/&gt;
    identifier far outweigh those of using 'struct'.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="methods"&gt;Methods&lt;/h3&gt;
&lt;p&gt;Structures in EDL can still contain methods as well as fields. These&lt;br/&gt;
methods, as in C++, are meant only to manipulate variables declared&lt;br/&gt;
explicitly in the structure.&lt;/p&gt;
&lt;h3 id="constructorsdestructors"&gt;Constructors/Destructors&lt;/h3&gt;
&lt;p&gt;Constructors and destructors can be defined as per ISO C++. A&lt;br/&gt;
constructor is denoted as a typeless function with the same name as the&lt;br/&gt;
class. A destructor is similar to the constructor, but is prefixed with&lt;br/&gt;
a tilde. Constructors can have parameters, which are passed while&lt;br/&gt;
initializing or instantiating with &lt;code&gt;operator new&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Unlike C++, member initialization is not done in a list before the body,&lt;br/&gt;
but instead is either done during the declaration or during the first&lt;br/&gt;
lines of the body.&lt;/p&gt;
&lt;h3 id="visibility"&gt;Visibility&lt;/h3&gt;
&lt;p&gt;Often, visibility settings (such as private, public, or protected) serve&lt;br/&gt;
to confuse or hinder in development. EDL does not enforce these&lt;br/&gt;
attributes, except where required by the host language while crawling&lt;br/&gt;
definitions. EDL instead shifts the responsibility to developers to&lt;br/&gt;
select an appropriate naming convention and follow the rules.&lt;/p&gt;
&lt;h3 id="sample"&gt;Sample&lt;/h3&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;struct&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;circle&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="k"&gt;var&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="n"&gt;double&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;radius&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="n"&gt;double&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;get_area&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;pi&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;radius&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;radius&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Simple&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;method&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="n"&gt;circle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;double&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;radius&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Optimizing&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;this&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;falls&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;on&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;the&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;language&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;plugin&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="n"&gt;circle&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;destroy_radius&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;radius&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h1 id="enumerations"&gt;Enumerations&lt;/h1&gt;
&lt;p&gt;As in ISO C++, enumeration values are to be regarded as strict&lt;br/&gt;
constants. When values are specified, they should be evaluable at the&lt;br/&gt;
time of parse. A sample enumeration is as follows:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;enum&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;In the above enumeration, as per ISO C++, the values of a, b, c, d, e&lt;br/&gt;
and f are respectively 0, 1, 2, 10, 11, 12. These values should be&lt;br/&gt;
assigned by the language-independent lexer upon initial parse. The&lt;br/&gt;
assignment operand for initialized constants is to be regarded as a&lt;br/&gt;
single token, though it may contain more complex expressions provided&lt;br/&gt;
that these expressions do not entail runtime computations.&lt;/p&gt;
&lt;p&gt;As with EDL structures, EDL enumerations need not be followed by a&lt;br/&gt;
semicolon, as declarations using the new type must be made separately.&lt;/p&gt;
&lt;h1 id="unions"&gt;Unions&lt;/h1&gt;
&lt;p&gt;Unions are also allowed in ENIGMA, but are not guaranteed to exhibit the&lt;br/&gt;
size of the largest type. Depending on the language plugin, the union&lt;br/&gt;
may in fact have the same size as the structure. As in ISO C++, EDL&lt;br/&gt;
unions do not permit objects with constructors as members.&lt;/p&gt;
&lt;h1 id="unions_1"&gt;Unions&lt;/h1&gt;
&lt;p&gt;Unions are also allowed in ENIGMA, but are not guaranteed to exhibit the&lt;br/&gt;
size of the largest type. Depending on the language plugin, the union&lt;br/&gt;
may in fact have the same size as the structure. As in ISO C++, EDL&lt;br/&gt;
unions do not permit objects with constructors as members.&lt;/p&gt;
&lt;h1 id="arrays"&gt;Arrays&lt;/h1&gt;
&lt;p&gt;EDL inherits JavaScript-like arrays rather than C++-like arrays. This is&lt;br/&gt;
so an array can serve as an lvalue, as in the following code:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;get_coordinates&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="k"&gt;var&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;fruits&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"apples"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"oranges"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"cherries"&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;In the above case, &lt;code&gt;x&lt;/code&gt; and &lt;code&gt;y&lt;/code&gt; are set to the first and second elements&lt;br/&gt;
in the array returned by &lt;code&gt;get_coordinates()&lt;/code&gt;, respectively. The second&lt;br/&gt;
line then declares a var and assigns the given array values to it.&lt;/p&gt;
&lt;p&gt;How this is accomplished after compile is outside the scope of this&lt;br/&gt;
specification. Consult the appropriate export language plug-in page for&lt;br/&gt;
details on implementation.&lt;/p&gt;
&lt;h1 id="preprocessors"&gt;Preprocessors&lt;/h1&gt;
&lt;p&gt;EDL supports a subset of preprocessors available in C. This subset&lt;br/&gt;
presently comprises &lt;code&gt;define&lt;/code&gt;, &lt;code&gt;error&lt;/code&gt;, &lt;code&gt;elif&lt;/code&gt;, &lt;code&gt;elifdef&lt;/code&gt;, &lt;code&gt;elifndef&lt;/code&gt;,&lt;br/&gt;
&lt;code&gt;else&lt;/code&gt;, &lt;code&gt;endif&lt;/code&gt;, &lt;code&gt;if&lt;/code&gt;, &lt;code&gt;ifdef&lt;/code&gt;, &lt;code&gt;ifndef&lt;/code&gt;, &lt;code&gt;undef&lt;/code&gt;, and &lt;code&gt;warning&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Unlike in C, preprocessors in EDL need not begin the line. Instead of&lt;br/&gt;
being set off by a pound symbol at the start of a line, they are&lt;br/&gt;
enclosed in double braces. For example, consider the following code:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="cp"&gt;{{&lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="cp"&gt;}}&lt;/span&gt;&lt;span class="x"&gt; &lt;/span&gt;&lt;span class="cp"&gt;{{&lt;/span&gt;&lt;span class="nv"&gt;define&lt;/span&gt; &lt;span class="nv"&gt;count&lt;/span&gt; &lt;span class="m"&gt;10&lt;/span&gt;&lt;span class="cp"&gt;}}&lt;/span&gt;&lt;span class="x"&gt; something = true;&lt;/span&gt;
&lt;span class="cp"&gt;{{&lt;/span&gt;&lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="cp"&gt;}}&lt;/span&gt;&lt;span class="x"&gt; &lt;/span&gt;&lt;span class="cp"&gt;{{&lt;/span&gt;&lt;span class="nv"&gt;define&lt;/span&gt; &lt;span class="nv"&gt;count&lt;/span&gt; &lt;span class="m"&gt;20&lt;/span&gt;&lt;span class="cp"&gt;}}&lt;/span&gt;&lt;span class="x"&gt; something = false; &lt;/span&gt;&lt;span class="cp"&gt;{{&lt;/span&gt;&lt;span class="nv"&gt;endif&lt;/span&gt;&lt;span class="cp"&gt;}}&lt;/span&gt;&lt;span class="x"&gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h1 id="types"&gt;Types&lt;/h1&gt;
&lt;p&gt;Typing in EDL is strictly static, though primitive types exist which&lt;br/&gt;
simulate dynamic&lt;br/&gt;
typing.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Primitive&lt;/th&gt;
&lt;th&gt;Range&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;bool&lt;/td&gt;
&lt;td&gt;A boolean value of true or false.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;char&lt;/td&gt;
&lt;td&gt;Integers from -128 to 127; often representing an ASCII letter&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;short&lt;/td&gt;
&lt;td&gt;Short integer from -32768 to 32767&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;int&lt;/td&gt;
&lt;td&gt;A standard, 32-bit integer; any number between -2147483648 and 2147483647&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;long&lt;/td&gt;
&lt;td&gt;A long integer; any number between -9223372036854775808 and 9223372036854775807&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;float&lt;/td&gt;
&lt;td&gt;A 32-bit floating point number; any revalues representedal number which can be represented by the IEEE floating point specification&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;double&lt;/td&gt;
&lt;td&gt;A 64-bit floating point number; any real number which can be represented by the IEEE floating point specification&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;instance_t&lt;/td&gt;
&lt;td&gt;The type needed to refer to any instance in ENIGMA.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;string&lt;/td&gt;
&lt;td&gt;An alias of std::string; any reasonably sized string of characters&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;variant&lt;/td&gt;
&lt;td&gt;Any value that can be stored by a &lt;strong&gt;double&lt;/strong&gt;, or any &lt;strong&gt;string&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;var&lt;/td&gt;
&lt;td&gt;A matrix of any positive dimension storing any number of values representable as &lt;strong&gt;double&lt;/strong&gt; and any number of &lt;strong&gt;string&lt;/strong&gt;s&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id="casting"&gt;Casting&lt;/h2&gt;
&lt;p&gt;Casting in ENIGMA is valid between any two numeric types. Casting from a&lt;br/&gt;
floating point type to an integer type will truncate the value, and&lt;br/&gt;
limit it to the max value of the given data type. Thus, &lt;code&gt;char(500.9)
= 127&lt;/code&gt;, and &lt;code&gt;char(100.9) = 100&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Casting from a numeric type to &lt;strong&gt;string&lt;/strong&gt; is also valid, but this must&lt;br/&gt;
be done explicitly using &lt;code&gt;string(number)&lt;/code&gt;, where number is any&lt;br/&gt;
real-valued variable.&lt;/p&gt;
&lt;p&gt;Casting from var to any scalar type will cast only the index &lt;code&gt;[0,0]&lt;/code&gt; in&lt;br/&gt;
the matrix.&lt;/p&gt;
&lt;p&gt;Casting to boolean differs by data type.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr class="header"&gt;
&lt;th&gt;&lt;p&gt;Type&lt;/p&gt;&lt;/th&gt;
&lt;th&gt;&lt;p&gt;Cast Method&lt;/p&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr class="odd"&gt;
&lt;td&gt;&lt;p&gt;bool&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;Casting a boolean to a boolean is not needed.&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class="even"&gt;
&lt;td&gt;&lt;p&gt;char, short,&lt;br/&gt;
int, long,&lt;br/&gt;
float, double,&lt;br/&gt;
long double&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;Casting from a numeric type to boolean is done per hardware specification; it is equivalent to &lt;code&gt;value != 0&lt;/code&gt;.&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class="odd"&gt;
&lt;td&gt;&lt;p&gt;instance_t&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;Casting instance_t &lt;em&gt;n&lt;/em&gt; to boolean is the same as comparing &lt;code&gt;value &amp;gt; 0&lt;/code&gt;.&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class="even"&gt;
&lt;td&gt;&lt;p&gt;variant, var&lt;/p&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;If the value represented is a string, then the cast is undefined. Otherwise, the cast is the same as &lt;code&gt;value &amp;gt; .5&lt;/code&gt;.&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;No special treatment is given to floats as such systems usually create&lt;br/&gt;
bizarre corner cases. If you are looking for a fast way to compare two&lt;br/&gt;
doubles with some laxity, cast both to float before running the&lt;br/&gt;
comparison.&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:15:22 -0000</pubDate><guid>https://sourceforge.net4752f38711a26402fec711cf4e058aaeef2b0045</guid></item></channel></rss>