#FEATURE by exept
authorClaus Gittinger <cg@exept.de>
Fri, 09 Aug 2019 10:19:45 +0200
changeset 24511 79c0b50a6788
parent 24510 e309e5fdf190
child 24512 e5777c042d6f
#FEATURE by exept class: InlineObject class added: #isAbstract #values:
InlineObject.st
--- a/InlineObject.st	Thu Aug 08 19:37:28 2019 +0200
+++ b/InlineObject.st	Fri Aug 09 10:19:45 2019 +0200
@@ -222,6 +222,27 @@
     "
 
     "Created: / 25-06-2019 / 16:53:50 / Claus Gittinger"
+!
+
+values:slotValues
+    "return a new inline object instance of myself,
+     given slot values (must be in my inst-slot order).
+     I must be the class of an existing concrete inline object,
+     not the (abstract) InlineObject class itself."
+
+    self == InlineObject ifTrue:[ self error:'only allowed for concrete inline object classes'].
+    ^ (slotValues copyAs:Array) changeClassTo:self
+
+    "
+     |proto protoClass|
+
+     proto := InlineObject slotNames:#('foo' 'bar' 'baz') values:#(1 2 3).
+     protoClass := proto class.
+     (protoClass values:#( 10 20 30 )) inspect.
+
+     raises an error:
+         InlineObject values:#(1 2 3)
+    "
 ! !
 
 !InlineObject class methodsFor:'prototype access'!
@@ -230,6 +251,16 @@
     ^ InlineObjectPrototype
 ! !
 
+!InlineObject class methodsFor:'queries'!
+
+isAbstract
+    "Return if this class is an abstract class.
+     True is returned here for myself only; false for subclasses.
+     Abstract subclasses must redefine this again."
+
+    ^ self == InlineObject.
+! !
+
 !InlineObject methodsFor:'printing & storing'!
 
 storeOn:aStream