Apparently you find a problem in self evaluating on color or related. Let me explain: The idea of printing an object is that in some case anObject printString let you recreate the object example 1 true #(1) #(1 2) 10@50 this means that either you get the same object or when you executed its printed representation you get it back. This is handy when playing with an inspector or in a workspace now for array if you get an array of points in the past printing it would return #(10 #@ 50 20 #@ 50) which is different from what is was really {10@50 . 20@50} or Array new: 2 at:1 put: 10@50 ; at:2 put: 20@50 So when an object is selfevaluating it measn that its printed representation can be used to recreate it When an array contains only self evaluating objects then it is printed with { } since it can also be recreated now if you get an object inside an array taht is not self evaluating then your collection cannot be self evaluating. so we say it anarray of ... instead of a #( 10 # @ 20....) But in your case something went wrong because color and others are self evaluating. could you provide with a snippet of code that we can check where the problem is coming from? Stef On Oct 27, 2009, at 10:58 PM, nullPointer wrote:
I don´t understand the behavior of printString method.
in a class I define a method #style , which returns an array...
style
style notNil ifTrue:[ ^style ] ifFalse:[ ^{ self borderColor . self borderWidth . self color . self gradientColor . (self cornerStyle = #rounded) . true }].
That method returns many times an Array. If #printString of that array is called the result is... '{Color black. 0. (Color r: 0.892 g: 0.887 b: 0.879). nil. false. true}'
Well i have another method with same name in another class
style
^{ self borderColor . self borderWidth . self color . self gradientColor . (self cornerStyle = #rounded) . true }
but in that case when i call #printString of the Array result ... 'an Array(Color transparent 0 (Color r: 0.827 g: 0.827 b: 0.827) nil true true)'.
I don´t understand nothing :| Both are instances of Array, and both is declared of same way.
Regards
-- View this message in context: http://n2.nabble.com/Strange-behavior-of-printString-method-tp3902051p390205... Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project