Pharo-dev
By thread
pharo-dev@lists.pharo.org
By month
Messages by month
- ----- 2026 -----
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
February 2017
- 673 messages
Re: [Pharo-dev] confused about printString and printIt
by Tudor Girba
Hi Sven,
It seems to me that we are now talking about double quote â. However, this is just a tool issue related to how to embed the result of Print It.
Just to remove the confusion, please resend this message without the âcommentâ printing :). Cmd-p + Cmd+p gets the plain result embedded.
Cheers,
Doru
> On Feb 19, 2017, at 12:14 PM, Sven Van Caekenberghe <sven(a)stfx.eu> wrote:
>
> But this *is* a discussion about the tools, not the implementation.
>
> ZnUrl is an example of class in the image that has a print representation like your object.
>
> So it looks like this (doing Print It in a Playground) (for me):
>
> 'https://pharo.org' asUrl. "https://pharo.org/"
> 'https://pharo.org' asUrl printString. "'https://pharo.org/'"
>
> But you seem to use a modification where the $" are not used ?
>
> I guess that the reason those $" are there is to make it a legal expression.
>
> Anyway, I do not see an underlying problem, only a possible discussion about what you would expect from the tools.
>
> Strings are poor representations, make them auto evaluate would make for much uglier text.
>
> I would not particularly like the following:
>
> 'https://pharo.org' asUrl. "ZnUrl fromString: 'https://pharo.org'"
>
> Or even:
>
> 'https://pharo.org' asUrl. "(ZnUrl fromString: 'https://pharo.org')"
>
> Though it is an option. (This goes for all similar objects, like date, time, ..).
>
> Then it does become a discussion about what a print string should be.
>
>> On 19 Feb 2017, at 11:42, stepharong <stepharong(a)free.fr> wrote:
>>
>> On Sun, 19 Feb 2017 11:40:04 +0100, Sven Van Caekenberghe <sven(a)stfx.eu> wrote:
>>
>>> Ah, you're right: there is a difference between printing a textual representation on a stream / window and doing the same with the actual (print)string. I was not yet fully awake I guess.
>>
>> So
>> 'comics'
>> >>> comics whatever it means
>> but
>> (#AAA asClass new name: 'comics')
>> >>> 'comics'
>>
>> I'm sorry but I do not get it at all.
>> Especially since we always wrote that printIt is sending printString.
>> I find that totally broken and I do not understand why this is good.
>>
>> Stef
>>
>>
>>
>>
>>>
>>>> On 19 Feb 2017, at 10:59, Tudor Girba <tudor(a)tudorgirba.com> wrote:
>>>>
>>>> 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:
>>>>
>>>> <Screen Shot 2017-02-19 at 10.48.55 AM.png>
>>>>
>>>> In Pharo 3, we have this in a Workspace:
>>>>
>>>> <Screen Shot 2017-02-19 at 10.49.26 AM.png>
>>>>
>>>> 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:
>>>>
>>>> <p1.png>
>>>>
>>>>
>>>> <p2.png>
>>>>
>>>> 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(a)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(a)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/
>
>
--
www.tudorgirba.com
www.feenk.com
"We can create beautiful models in a vacuum.
But, to get them effective we have to deal with the inconvenience of reality."
Feb. 19, 2017
Re: [Pharo-dev] confused about printString and printIt
by Sven Van Caekenberghe
But this *is* a discussion about the tools, not the implementation.
ZnUrl is an example of class in the image that has a print representation like your object.
So it looks like this (doing Print It in a Playground) (for me):
'https://pharo.org' asUrl. "https://pharo.org/"
'https://pharo.org' asUrl printString. "'https://pharo.org/'"
But you seem to use a modification where the $" are not used ?
I guess that the reason those $" are there is to make it a legal expression.
Anyway, I do not see an underlying problem, only a possible discussion about what you would expect from the tools.
Strings are poor representations, make them auto evaluate would make for much uglier text.
I would not particularly like the following:
'https://pharo.org' asUrl. "ZnUrl fromString: 'https://pharo.org'"
Or even:
'https://pharo.org' asUrl. "(ZnUrl fromString: 'https://pharo.org')"
Though it is an option. (This goes for all similar objects, like date, time, ..).
Then it does become a discussion about what a print string should be.
> On 19 Feb 2017, at 11:42, stepharong <stepharong(a)free.fr> wrote:
>
> On Sun, 19 Feb 2017 11:40:04 +0100, Sven Van Caekenberghe <sven(a)stfx.eu> wrote:
>
>> Ah, you're right: there is a difference between printing a textual representation on a stream / window and doing the same with the actual (print)string. I was not yet fully awake I guess.
>
> So
> 'comics'
> >>> comics whatever it means
> but
> (#AAA asClass new name: 'comics')
> >>> 'comics'
>
> I'm sorry but I do not get it at all.
> Especially since we always wrote that printIt is sending printString.
> I find that totally broken and I do not understand why this is good.
>
> Stef
>
>
>
>
>>
>>> On 19 Feb 2017, at 10:59, Tudor Girba <tudor(a)tudorgirba.com> wrote:
>>>
>>> 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:
>>>
>>> <Screen Shot 2017-02-19 at 10.48.55 AM.png>
>>>
>>> In Pharo 3, we have this in a Workspace:
>>>
>>> <Screen Shot 2017-02-19 at 10.49.26 AM.png>
>>>
>>> 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:
>>>
>>> <p1.png>
>>>
>>>
>>> <p2.png>
>>>
>>> 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(a)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(a)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/
Feb. 19, 2017
Re: [Pharo-dev] confused about printString and printIt
by stepharong
On Sun, 19 Feb 2017 11:40:04 +0100, Sven Van Caekenberghe <sven(a)stfx.eu>
wrote:
> Ah, you're right: there is a difference between printing a textual
> representation on a stream / window and doing the same with the actual
> (print)string. I was not yet fully awake I guess.
So
'comics'
>>> comics whatever it means
but
(#AAA asClass new name: 'comics')
>>> 'comics'
I'm sorry but I do not get it at all.
Especially since we always wrote that printIt is sending printString.
I find that totally broken and I do not understand why this is good.
Stef
>
>> On 19 Feb 2017, at 10:59, Tudor Girba <tudor(a)tudorgirba.com> wrote:
>>
>> 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:
>>
>> <Screen Shot 2017-02-19 at 10.48.55 AM.png>
>>
>> In Pharo 3, we have this in a Workspace:
>>
>> <Screen Shot 2017-02-19 at 10.49.26 AM.png>
>>
>> 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:
>>
>> <p1.png>
>>
>>
>> <p2.png>
>>
>> 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(a)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(a)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/
Feb. 19, 2017
Re: [Pharo-dev] confused about printString and printIt
by Sven Van Caekenberghe
Ah, you're right: there is a difference between printing a textual representation on a stream / window and doing the same with the actual (print)string. I was not yet fully awake I guess.
> On 19 Feb 2017, at 10:59, Tudor Girba <tudor(a)tudorgirba.com> wrote:
>
> 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:
>
> <Screen Shot 2017-02-19 at 10.48.55 AM.png>
>
> In Pharo 3, we have this in a Workspace:
>
> <Screen Shot 2017-02-19 at 10.49.26 AM.png>
>
> 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:
>
> <p1.png>
>
>
> <p2.png>
>
> 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(a)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(a)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."
>
>
>
>
>
Feb. 19, 2017
Re: [Pharo-dev] confused about printString and printIt
by stepharong
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(a)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(a)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/
Feb. 19, 2017
Re: [Pharo-dev] confused about printString and printIt
by Tudor Girba
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(a)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(a)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."
Feb. 19, 2017
Re: [Pharo-dev] confused about printString and printIt
by Sven Van Caekenberghe
Stef is right, there is something strange. Consider the following 4 expressions, each time with the result of 'Print It' inserted:
#foo->'foo'. "#foo->'foo'"
(#foo->'foo') printString. "'#foo->''foo'''"
'foo'. "'foo'"
'foo' printString. "'''foo'''"
In a Workspace (not Playground), the following happens:
#foo->'foo'. #foo->'foo'
#foo->'foo' printString. #foo->'''foo'''
Which makes even less sense.
> On 19 Feb 2017, at 09:06, stepharong <stepharong(a)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(a)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>
Feb. 19, 2017
Re: [Pharo-dev] confused about printString and printIt
by stepharong
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'
>
>
>
> What am I missing?
>
> Cheers,
> Doru
>
>
>> On Feb 18, 2017, at 6:26 PM, stepharong <stepharong(a)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/
Feb. 19, 2017
Re: [Pharo-dev] confused about printString and printIt
by Tudor Girba
Hi Stef,
I think I do not understand the issue.
Here is the screenshot of a Playground.
âcomicsâ -> print-it -> âcomics'
What am I missing?
Cheers,
Doru
> On Feb 18, 2017, at 6:26 PM, stepharong <stepharong(a)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."
Feb. 19, 2017
Re: [Pharo-dev] Seeking support: Vote for Jigyasa Grover for Red Hat International Women in Open Source Academic Awards 2017
by Jigyasa Grover
Kilon, Thanks :)
- Jigyasa
--
View this message in context: http://forum.world.st/Seeking-support-Vote-for-Jigyasa-Grover-for-Red-Hat-I…
Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
Feb. 19, 2017