InlineObjectClassDescription.st
changeset 24517 5aaa5e876057
parent 24240 5a8ca163fbfc
child 24519 e39e3ee07aed
--- a/InlineObjectClassDescription.st	Fri Aug 09 11:42:47 2019 +0200
+++ b/InlineObjectClassDescription.st	Fri Aug 09 11:42:57 2019 +0200
@@ -16,7 +16,7 @@
 "{ NameSpace: Smalltalk }"
 
 ClassDescription subclass:#InlineObjectClassDescription
-	instanceVariableNames:''
+	instanceVariableNames:'name'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'Kernel-Classes'
@@ -77,14 +77,46 @@
 "
 ! !
 
+!InlineObjectClassDescription methodsFor:'accessing'!
+
+setName:newName
+    "because classes are shared, multiple uses may try to use different names.
+     I am anonymous anyway, so the name is only kept for the user's convenience
+     (i.e. to provide a nicer printString)
+     Only remember the very first one.
+     (maybe we should concatenate names instead)."
+
+    name isNil ifTrue:[
+        name := newName
+    ] ifFalse:[
+        name = newName ifFalse:[
+            name := name,'/',newName
+        ].
+    ].
+
+    "
+     |o1 o2|
+
+     o1 := InlineObject slotNames:#('foo' 'bar' 'baz' 'bla') values:#(1 2 3 4).
+     o1 class setName:'myFoo'.
+     o2 := InlineObject slotNames:#('foo' 'bar' 'baz' 'bla') values:#(1 2 3 4).
+     o2 class setName:'myFoo2'.
+     o1 inspect.
+     o2 inspect.
+    "
+
+    "Created: / 25-06-2019 / 16:40:36 / Claus Gittinger"
+    "Modified: / 28-06-2019 / 14:38:32 / Claus Gittinger"
+! !
+
 !InlineObjectClassDescription methodsFor:'queries'!
 
 name
-    "although inline objects have no name, we return something
+    "although inline objects usually have no name, we return something
      useful here - there are many places (inspectors) where
      a classes name is asked for."
 
-    ^ #'someInlineObject'
+    ^ name ? #'someInlineObject'
 !
 
 nameSpace