#DOCUMENTATION by exept
authorClaus Gittinger <cg@exept.de>
Thu, 20 Feb 2020 08:58:29 +0100
changeset 25274 91b4e325fddf
parent 25273 87ad8bae24e5
child 25275 1030a738885a
#DOCUMENTATION by exept class: InlineObject class comment/format in: #documentation
InlineObject.st
--- a/InlineObject.st	Wed Feb 19 20:55:47 2020 +0100
+++ b/InlineObject.st	Thu Feb 20 08:58:29 2020 +0100
@@ -64,29 +64,37 @@
 
     InlineObjects are written as literals of the form:
 
-    #{
-        fieldName1: value1.
-        fieldName2: value2.
-        ...
-        fieldNameN: valueN.
-    }
+        #{
+            fieldName1: value1.
+            fieldName2: value2.
+            ...
+            fieldNameN: valueN.
+        }
 
     For example:
 
-    #{
-        firstName: 'Peter'.
-        lastName: 'Miller'.
-        age: 25.
-    }
+        #{
+            firstName: 'Peter'.
+            lastName: 'Miller'.
+            age: 25.
+        }
 
-    #{
-        date:  Date today.
-        time:  Time now.
-    }
+    The above was an inline literal: all field values must be again literals.
+
+    However, similar to brace-Arrays, inline objects can also be dynamically created (constructed):
+        {
+            date:  Date today.
+            time:  Time now.
+        }
 
     All inlineObjects will be instances of an anonymous subclass of me,
     and provide getter protocol for their fields (e.g. firstName, lastName and age in the above example.
-    InlineObjects are immutable (no setters).
+    Literal InlineObjects are immutable (no setters), whereas constructed are not.
+
+        |foo|
+        foo := { date:  Date today. time:  Time now }.
+        foo date:(Date yesterday).
+        foo  
 "
 ! !