<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to Enums</title><link>https://sourceforge.net/p/asil/wiki/Enums/</link><description>Recent changes to Enums</description><atom:link href="https://sourceforge.net/p/asil/wiki/Enums/feed" rel="self"/><language>en</language><lastBuildDate>Thu, 20 Feb 2014 22:37:34 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/asil/wiki/Enums/feed" rel="self" type="application/rss+xml"/><item><title>Enums modified by Will Pittenger</title><link>https://sourceforge.net/p/asil/wiki/Enums/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v20
+++ v21
@@ -74,7 +74,7 @@

 ~~~~
 :::text
-enum struct MyStructEnum
+enum structure MyStructEnum
   values
     left "left"
     top "top"
@@ -89,15 +89,15 @@

 Using custom base types for your enum
 -------------------------------------
-Non-enum types can derive from "&lt;code&gt;System.Enums.StructBased&lt;/code&gt;" as long as they're declared as "&lt;code&gt;**[abstract](keywords-abstract)** **[struct](keywords-struct)**&lt;/code&gt;" and not as an **[enum](keywords-enum)**.  Now you can add a **[extends](keywords-extends)** clause to your enum type.
+Non-enum types can derive from "&lt;code&gt;System.Enums.StructBased&lt;/code&gt;" as long as they're declared as "&lt;code&gt;**[abstract](keywords-abstract)** **[structure](keywords-structure)**&lt;/code&gt;" and not as an **[enum](keywords-enum)**.  Now you can add a **[extends](keywords-extends)** clause to your enum type.  The first type in that **[extends](keywords-extends)** clause &lt;u&gt;must&lt;/u&gt; be derived an **[abstract](keywords-abstract)** **[structure](keywords-structure)** derived from "&lt;code&gt;System.Enums.StructBased&lt;/code&gt;".  Other types listed can be any needed **[structure](keywords-structure)**.

 ~~~~
 :::text
-abstract struct MyEnumBaseType
+abstract structure MyEnumBaseType
     extends System.Enums.StructBased
   ' Add some extra members, methods, and properties.

-enum struct MyEnumType
+enum structure MyEnumType
     extends MyEnumBaseType
   values
     left "left"
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Will Pittenger</dc:creator><pubDate>Thu, 20 Feb 2014 22:37:34 -0000</pubDate><guid>https://sourceforge.net6af6a3a4847530273b2e60d0dfed760d3561da17</guid></item><item><title>Enums modified by Will Pittenger</title><link>https://sourceforge.net/p/asil/wiki/Enums/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Will Pittenger</dc:creator><pubDate>Tue, 18 Feb 2014 12:05:00 -0000</pubDate><guid>https://sourceforge.netd25f3978f38b5033f406106a477e1666fcb187b4</guid></item><item><title>Enums modified by Will Pittenger</title><link>https://sourceforge.net/p/asil/wiki/Enums/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Will Pittenger</dc:creator><pubDate>Tue, 18 Feb 2014 12:04:25 -0000</pubDate><guid>https://sourceforge.netf8b03bc9545a678f4092753ecbbd8dd902049e44</guid></item><item><title>Enums modified by Will Pittenger</title><link>https://sourceforge.net/p/asil/wiki/Enums/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v17
+++ v18
@@ -22,7 +22,7 @@

 Specifying the base type
 ------------------------
-The above sample uses int as the base type.  This means the number of possible values varies with the size of a word.  If you want to change that, use the syntax below.  Any integer type, signed or unsigned, will work.  Enums of this type also can't be compared to any other type unless you manually assign values to entries as shown in the next section.  In that case, comparisons are subject to the usual number conversion rules.  Even though you're specifying one type, the real base type is "&lt;code&gt;System.Enums.PrimitiveBased&amp;lt;TypeName&amp;gt;&lt;/code&gt;" where "&lt;code&gt;TypeName&lt;/code&gt;" is the type given.  If you leave **[extends](keywords-extends)** clause out, you're deriving from "&lt;code&gt;System.Enums.PrimitiveBased&amp;lt;int&amp;gt;&lt;/code&gt;".
+The above sample uses int as the base type.  This means the number of possible values varies with the size of a word.  If you want to change that, use the syntax below.  Any integer type, signed or unsigned, will work.  Enums of this type also can't be compared to any other type unless you manually assign values to entries as shown in the next section.  In that case, comparisons are subject to the usual number conversion rules.  Even though you're specifying one type, the real base type is "&lt;code&gt;System.Enums.PrimitiveBased&amp;lt;TypeName&amp;gt;&lt;/code&gt;" where "&lt;code&gt;TypeName&lt;/code&gt;" is the type given.  If you leave **[extends](keywords-extends)** clause out, you're deriving from "&lt;code&gt;System.Enums.PrimitiveBased&amp;lt;int&amp;gt;&lt;/code&gt;".  The type listed can be any primitive type declared by ASIL or a **[struct](keywords-struct)** with only one field that isn't **[abstract](keywords-abstract)**.  That field must be a primitive.

 ~~~~
 :::text
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Will Pittenger</dc:creator><pubDate>Tue, 18 Feb 2014 12:04:08 -0000</pubDate><guid>https://sourceforge.netb6c4cecaf66e63f28e23df1878353f86368748ed</guid></item><item><title>Enums modified by Will Pittenger</title><link>https://sourceforge.net/p/asil/wiki/Enums/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v16
+++ v17
@@ -89,7 +89,7 @@

 Using custom base types for your enum
 -------------------------------------
-Non-enum types can derive from "&lt;code&gt;System.Enums.StructBased&lt;/code&gt;" as long as they're declared as "&lt;code&gt;**[abstract](keywords-abstract) **[struct](keywords-struct)**&lt;/code&gt;" and not as an **[enum](keywords-enum)**.  Now you can add a **[extends](keywords-extends)** clause to your enum type.
+Non-enum types can derive from "&lt;code&gt;System.Enums.StructBased&lt;/code&gt;" as long as they're declared as "&lt;code&gt;**[abstract](keywords-abstract)** **[struct](keywords-struct)**&lt;/code&gt;" and not as an **[enum](keywords-enum)**.  Now you can add a **[extends](keywords-extends)** clause to your enum type.

 ~~~~
 :::text
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Will Pittenger</dc:creator><pubDate>Tue, 18 Feb 2014 11:56:47 -0000</pubDate><guid>https://sourceforge.netf484754bd536e6576a53db801255e3d6520e2afa</guid></item><item><title>Enums modified by Will Pittenger</title><link>https://sourceforge.net/p/asil/wiki/Enums/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v15
+++ v16
@@ -70,11 +70,35 @@

 Struct-based enums
 ==================
-Enums in java are more complex.  You have more flexibility, but matching a C++ enum type is tough at best.  ASIL lets you do either.  Note the specialized syntax.  Please note **[enum](keywords-enum)** values of this type have no internal value until you provide one!!!  You're also expected to provide any operators required except the equality and inequality operators.  (Those are generated for you, but can be provided manually anyway when needed.)  Enum constructors are implicitly private.  Enum types of this type derive from "&lt;code&gt;System.Enums.StructBased&lt;/code&gt;".
+Enums in java are more complex.  You have more flexibility, but matching a C++ enum type is tough at best.  ASIL lets you do either.  Note the specialized syntax.  Please note **[enum](keywords-enum)** values of this type have no internal value until you provide one!!!  You're also expected to provide any operators required except the equality and inequality operators.  (Those are generated for you, but can be provided manually anyway when needed.)  Enum constructors are implicitly private.  Enum types of this type derive from "&lt;code&gt;System.Enums.StructBased&lt;/code&gt;".  Non-enum types can derive from "&lt;code&gt;System.Enums.StructBased&lt;/code&gt;" as long as they're declared as "&lt;code&gt;**[abstract](keywords-abstract) **[struct](keywords-struct)**&lt;/code&gt;" and not as an **[enum](keywords-enum)**.

 ~~~~
 :::text
 enum struct MyStructEnum
+  values
+    left "left"
+    top "top"
+    right "right"
+    bottom "bottom"
+
+  public var readonly String strValue
+
+  constructor var const String strValue
+    self.strValue = strValue
+~~~~
+
+Using custom base types for your enum
+-------------------------------------
+Non-enum types can derive from "&lt;code&gt;System.Enums.StructBased&lt;/code&gt;" as long as they're declared as "&lt;code&gt;**[abstract](keywords-abstract) **[struct](keywords-struct)**&lt;/code&gt;" and not as an **[enum](keywords-enum)**.  Now you can add a **[extends](keywords-extends)** clause to your enum type.
+
+~~~~
+:::text
+abstract struct MyEnumBaseType
+    extends System.Enums.StructBased
+  ' Add some extra members, methods, and properties.
+
+enum struct MyEnumType
+    extends MyEnumBaseType
   values
     left "left"
     top "top"
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Will Pittenger</dc:creator><pubDate>Tue, 18 Feb 2014 11:55:29 -0000</pubDate><guid>https://sourceforge.netcaa30c716a5a1393ef3b9e178178b91eeada1fe9</guid></item><item><title>Enums modified by Will Pittenger</title><link>https://sourceforge.net/p/asil/wiki/Enums/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v14
+++ v15
@@ -22,12 +22,12 @@

 Specifying the base type
 ------------------------
-The above sample uses int as the base type.  This means the number of possible values varies with the size of a word.  If you want to change that, use the syntax below.  Any integer type, signed or unsigned, will work.  Enums of this type also can't be compared to any other type unless you manually assign values to entries as shown in the next section.  In that case, comparisons are subject to the usual number conversion rules.
+The above sample uses int as the base type.  This means the number of possible values varies with the size of a word.  If you want to change that, use the syntax below.  Any integer type, signed or unsigned, will work.  Enums of this type also can't be compared to any other type unless you manually assign values to entries as shown in the next section.  In that case, comparisons are subject to the usual number conversion rules.  Even though you're specifying one type, the real base type is "&lt;code&gt;System.Enums.PrimitiveBased&amp;lt;TypeName&amp;gt;&lt;/code&gt;" where "&lt;code&gt;TypeName&lt;/code&gt;" is the type given.  If you leave **[extends](keywords-extends)** clause out, you're deriving from "&lt;code&gt;System.Enums.PrimitiveBased&amp;lt;int&amp;gt;&lt;/code&gt;".

 ~~~~
 :::text
 enum AnotherEnumType
-    inherits int64
+    extends int64
   left
   right
   top
@@ -70,7 +70,7 @@

 Struct-based enums
 ==================
-Enums in java are more complex.  You have more flexibility, but matching a C++ enum type is tough at best.  ASIL lets you do either.  Note the specialized syntax.  Please note **[enum](keywords-enum)** values of this type have no internal value until you provide one!!!  You're also expected to provide any operators required except the equality and inequality operators.  (Those are generated for you, but can be provided manually anyway when needed.)  Enum constructors are implicitly private.
+Enums in java are more complex.  You have more flexibility, but matching a C++ enum type is tough at best.  ASIL lets you do either.  Note the specialized syntax.  Please note **[enum](keywords-enum)** values of this type have no internal value until you provide one!!!  You're also expected to provide any operators required except the equality and inequality operators.  (Those are generated for you, but can be provided manually anyway when needed.)  Enum constructors are implicitly private.  Enum types of this type derive from "&lt;code&gt;System.Enums.StructBased&lt;/code&gt;".

 ~~~~
 :::text
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Will Pittenger</dc:creator><pubDate>Tue, 18 Feb 2014 11:43:30 -0000</pubDate><guid>https://sourceforge.net8e5e1572438766f5a5a17bd637579143d8b5485e</guid></item><item><title>Enums modified by Will Pittenger</title><link>https://sourceforge.net/p/asil/wiki/Enums/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v13
+++ v14
@@ -94,3 +94,7 @@
 Allowing null values
 --------------------
 Once again, if you need to allow a null value, explicitly list the **[null](keywords-null)** keyword as an entry with no parameters (you aren't calling a constructor).  The **[?](operators-question)** type modifier is invalid for enum types.
+
+Behind the scenes
+-----------------
+Even though the same of this type of enum is "structure-based enums", they are a reference type.  Your enum type will never have more instances than listed in by the **[values](keywords-values)** keyword.
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Will Pittenger</dc:creator><pubDate>Mon, 17 Feb 2014 13:41:48 -0000</pubDate><guid>https://sourceforge.netd458984ebae7bfe8a085be34a8e736794f60ccb7</guid></item><item><title>Enums modified by Will Pittenger</title><link>https://sourceforge.net/p/asil/wiki/Enums/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v12
+++ v13
@@ -93,4 +93,4 @@

 Allowing null values
 --------------------
-Once again, if you need to allow a null value, explicitly list the **[null](keywords-null)** keyword as an entry with no explicit value.  The **[?](operators-question)** type modifier is invalid for enum types.
+Once again, if you need to allow a null value, explicitly list the **[null](keywords-null)** keyword as an entry with no parameters (you aren't calling a constructor).  The **[?](operators-question)** type modifier is invalid for enum types.
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Will Pittenger</dc:creator><pubDate>Mon, 17 Feb 2014 13:39:52 -0000</pubDate><guid>https://sourceforge.net153df677fe62279fd2f36f227d4bfcb5c3e4d326</guid></item><item><title>Enums modified by Will Pittenger</title><link>https://sourceforge.net/p/asil/wiki/Enums/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v11
+++ v12
@@ -11,6 +11,7 @@
 Below is a sample of code declaring an enum that lets the compiler the numeric values behind each value in the enum type.  You would reference the values in this manner: &lt;code&gt;MyEnumType.left&lt;/code&gt;.  Enums of this type can't be compared to any other type.

 ~~~~
+:::text
 enum MyEnumType
   left
   both
@@ -24,6 +25,7 @@
 The above sample uses int as the base type.  This means the number of possible values varies with the size of a word.  If you want to change that, use the syntax below.  Any integer type, signed or unsigned, will work.  Enums of this type also can't be compared to any other type unless you manually assign values to entries as shown in the next section.  In that case, comparisons are subject to the usual number conversion rules.

 ~~~~
+:::text
 enum AnotherEnumType
     inherits int64
   left
@@ -37,6 +39,7 @@
 Some enum types need to match the values used in external code.  Suppose you have a C++ enum type to match.  Enums of this type can be compared to number types using the normal number comparison rules.  Use this syntax:

 ~~~~
+:::text
 enum ExternalEnumType
   outside = 3 ' Any entries before the first entry with an explicit value gets a value chosen by the compiler that doesn't conflict with the values of any other entries.  Such values can't be compared and have no value for increment, decrement, or comparison operators (except the equality and inequality operators).
   inside = 4
@@ -48,6 +51,7 @@
 You can't use **[++](operators-inc)** or **[--](operators-dec)** with primitive-based enum types unless the first value manually specifies a value.  If you let the compiler pick the values, the values are considered to be unordered.  This means you also can't do any comparisons other than equality and inequality.  While primitive-based enum types that have manually assigned values can be used with **[++](operators-inc)** and **[--](operators-dec)**, the code below would throw a NoNumbericValueInEnumInstanceError.  (This type is derived from Error and doesn't need to be caught or declared.)

 ~~~~
+:::text
 enum BadType
   a ' No defined value!
   b = 3 ' Only entries after b have a value that can be referenced as b is the first entry with an explicit value
@@ -60,11 +64,16 @@
 BadEnum ++ ' This won't change the value stored as there's only one value with a explicit value.
 ~~~~

+Allowing null values
+--------------------
+If you need to allow a null value, explicitly list the **[null](keywords-null)** keyword as an entry with no explicit value.  The **[?](operators-question)** type modifier is invalid for enum types.
+
 Struct-based enums
 ==================
 Enums in java are more complex.  You have more flexibility, but matching a C++ enum type is tough at best.  ASIL lets you do either.  Note the specialized syntax.  Please note **[enum](keywords-enum)** values of this type have no internal value until you provide one!!!  You're also expected to provide any operators required except the equality and inequality operators.  (Those are generated for you, but can be provided manually anyway when needed.)  Enum constructors are implicitly private.

 ~~~~
+:::text
 enum struct MyStructEnum
   values
     left "left"
@@ -81,3 +90,7 @@
 Using Increment/Decrement operators with struct-based enum types
 ----------------------------------------------------------------
 Struct-based enum types can't be used with **[++](operators-inc)** or **[--](operators-dec)** unless you implement the operators in the type.  Ditto for all comparison operators other than equality and inequality.  See [Custom operators] for information on how to do that.
+
+Allowing null values
+--------------------
+Once again, if you need to allow a null value, explicitly list the **[null](keywords-null)** keyword as an entry with no explicit value.  The **[?](operators-question)** type modifier is invalid for enum types.
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Will Pittenger</dc:creator><pubDate>Sun, 16 Feb 2014 10:26:27 -0000</pubDate><guid>https://sourceforge.net5573cb5317a31319dd1dab9f1326b386befbaf69</guid></item></channel></rss>