help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: printNl question


From: address@hidden
Subject: Re: printNl question
Date: Mon, 19 Apr 2021 09:51:13 +0200 (CEST)

Not sure whether this helps but there also exists a #displayNl message.

bash-4.4$ gst
GNU Smalltalk ready

st> 'hello' printNl
'hello'
'hello'
st> 'hello' displayNl
hello
'hello'
st> Smalltalk version
'GNU Smalltalk version 3.2.91'

Note that for #printNl the output has '' quotes and for #displayNl it does not.

If you check the source code in Object.st  
(/usr/share/smalltalk/kernel/Object.st)

    displayNl [
        "Print a represention of the receiver, then put a new line on
         the Transcript (stdout the GUI is not active). For most objects this
         is simply its #printNl representation, but for strings and
         characters, superfluous dollars or extra pair of quotes are stripped."

        <category: 'printing'>
        Transcript showCr: self displayString
    ]

so the description comment of displayNl explicitely talks about 'extra pair of 
quotes'.

----- Op 19 apr 2021 om 1:48 schreef Duke Normandin dukeofpurl@gmx.com:

> On Sun, 18 Apr 2021 19:04:10 -0400
> bill-auger <bill-auger@peers.community> wrote:
> 
>> rather than casual explanations of the problem, it is usually
>> more helpful to show the exact commands and output - for
>> example, is this what you are seeing?
>>
>>   $ gst
>>
>>   st> 'hello' printNl
>>   'hello'
>>   'hello'
>>
>>   st> Transcript show: 'hello' ; cr
>>   hello
>>   Transcript
> 
> Yes! That's the output I'm getting.
> 
> I've work quite a lot with various LISP REPLs, so I get it about the "double"
> output while working in the REPL.
> 
> However, I'm getting the same behaviour executing the source code file from 
> the
> CLI.
> --
> Duke



reply via email to

[Prev in Thread] Current Thread [Next in Thread]