I do not say that it is a problem of playground. I'm saying that our tools are breaking an important invariant. Printit should not produce "strings" that are not objects. What I'm saying it that - axiom one printString returns a string. - printIt send printString to the object and why does it no display a string except for objects whose representation is themselves. The problem not to put '' around string is that we get a broken things. In Pharo we have tools that when they should display a string return a "we do not know what" because it is not a literal! 'comics' Printit does not produce comics but 'comics' so why do we have (#AAA asClass new name: 'comics') printit because this is insane. It breaks everyrhing Stef
Hi,
Hmm, I think I do not see it :).
Letâs take it slowly. From what I see, the behavior is the same since at least Pharo 3.
Here is a script that seems to reproduce your situation:
Object subclass: #AAA instanceVariableNames: 'name' classVariableNames: '' package: 'AAA'. #AAA asClass compile: 'printOn: aStream aStream << name'. #AAA asClass compile: 'name: aString name := aString'. #AAA asClass new name: 'comics'
In Pharo 6, we have in a Playground:
In Pharo 3, we have this in a Workspace:
Calling Print It on an object produces a string out of the contents of the stream, and displaying it shows the contents of the stream (so, no quotes). Calling Print It on a string produces a string of >the string, and displaying it shows the quotes of the first string.
You can see this in the String tab of the inspector:
Does this make sense?
I think this is not inconsistent, but maybe there is a better way. In any case, the behavior seems to exist since a long time.
Cheers, Doru
On Feb 19, 2017, at 9:06 AM, stepharong <stepharong@free.fr> wrote:
Hi doru
may be I do not see the obvious. I defined a class
Object subclass: #MFElement instanceVariableNames: 'name parent' classVariableNames: '' package: 'MyFS2'
printOn: aStream parent isNil ifFalse: [ parent printOn: aStream ]. aStream << name
name: aString name := aString
MFDirectory new name: 'comics'.
And when I do
(MFDirectory new name: 'comics') comics/
(MFDirectory new name: 'comics') printString
'comics/'
Hi Stef,
I think I do not understand the issue.
Here is the screenshot of a Playground.
âcomicsâ -> print-it -> âcomics'
<Mail Attachment.png>
What am I missing?
Cheers, Doru
On Feb 18, 2017, at 6:26 PM, stepharong <stepharong@free.fr> wrote:
Hi guys
I'm working on an introduction chapter for my future book and I do not like the behavior I see in latest pharo 60.
And I do not understand the behavior of print-it
(MFDirectory new name: 'comics') comics/
(MFDirectory new name: 'comics') printString
'comics/'
Why print it does not produce ''?
Stef
printIt "Treat the current text selection as an expression; evaluate it. Insert the description of the result of evaluation after the selection and then make this description the new text selection."
| printString | self evaluateSelectionAndDo: [ :result | printString := [ result printString ] on: Error do: [ '<error in printString: try ''Inspect it'' to debug>' ]. self afterSelectionInsertAndSelect: printString ]
--Using Opera's mail client: http://www.opera.com/mail/
-- www.tudorgirba.com www.feenk.com
"It's not how it is, it is how we see it."
--Using Opera's mail client: http://www.opera.com/mail/ <MFElement.st>
-- www.tudorgirba.com www.feenk.com
"Problem solving should be focused on describing the problem in a way that makes the solution obvious."
-- Using Opera's mail client: http://www.opera.com/mail/