[squeak-dev] The Inbox: System-ct.1120.mcz

Chris Muller asqueaker at gmail.com
Fri Dec 6 21:17:27 UTC 2019


More abstractly (not specific to this commit) -- since early 2000's, I've
extended my domains with #printAbbreviatedOn: and found it to be very
useful.  It's responsible for printing an objects "identifying" attribute
only, nothing else (not even its class).  It's goal is to be very short,
preferably one word, but never more than one line.  This helps the
fundamental use-case for when you only want to see the "exterior" of the
object and not the interior.  For example, printing a Collection's
elements.  You only care about *which objects* are in there, not the
detailed printString contents.


On Tue, Dec 3, 2019 at 12:35 PM Thiede, Christoph <
Christoph.Thiede at student.hpi.uni-potsdam.de> wrote:

> Sorry for the confusion. As I tried to explain, I must admit that I never
> wrote a real implementation of #shortPrintString. I was not aware of this
> when I uploaded this commit. The implementation I used for testing was only
> a fake:
>
>
> shortPrintString
>
>     ^ self printString copyWithRegex: '\s*' matchesReplacedWith: ' '
>
> I don't think this would be valuable for Trunk? Do you think an
> implementation of ParseNode>>#shortPrintString would be useful in general,
> or could we use the "copyWithRegex" trick in #
> initializeCommonRequestStrings?
>
> Best,
> Christoph
> ------------------------------
> *Von:* Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im
> Auftrag von Taeumel, Marcel
> *Gesendet:* Dienstag, 3. Dezember 2019 09:25:54
> *An:* John Pfersich via Squeak-dev
> *Betreff:* Re: [squeak-dev] The Inbox: System-ct.1120.mcz
>
> Hi Christoph.
>
> > I'm afraid that this implementation must be missing at the moment.
>
> I am a little bit confused. You added the very first send of #veryShortPrintOn:
> in System-ct.1117. No class implements it. Then, in System-ct.1120, you
> changed that to #shortPrintString, which is only implemented on Color.
> Then again, ParseNode implements #shortPrintOn:.
>
> So, could you please add #shortPrintString to this inbox commit? :-)
>
> Best,
> Marcel
>
> Am 03.12.2019 08:54:05 schrieb Thiede, Christoph <
> christoph.thiede at student.hpi.uni-potsdam.de>:
>
> Hi Marcel, sorry for the really long delay!
>
>
> I'm afraid that this implementation must be missing at the moment. In my
> image, I had fast faked it with:
>
>
> shortPrintString
>
>     ^ self printString copyWithRegex: '\s*' matchesReplacedWith: ' '
>
>
> But respecting parse trees such as ['  ' , '
>
> '] decompile (sic), I am not sure whether this would be a good
> implementation ...
>
> Otherwise, implementing something like #shortPrintOn: in every ParseNode
> class would cause a lot of duplication or, alternatively, raise the
> complexity of the existing printing methods (each extended with another
> argument for the print selector to use for descendents).
>
>
> In general, do you think such a method might be useful at all? If not, the
> "regex replace" trick could be directly applied in initializeCommonRequestStrings,
> how do you think about it?
>
>
> Best,
>
> Christoph
> ------------------------------
> *Von:* Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im
> Auftrag von Taeumel, Marcel
> *Gesendet:* Dienstag, 19. November 2019 12:03:30
> *An:* John Pfersich via Squeak-dev
> *Betreff:* Re: [squeak-dev] The Inbox: System-ct.1120.mcz
>
> Hi Christoph.
>
> Neither #veryShortPrintOn: nor #shortPrintString are implemented in
> ParseNode. Does this contribution depend on something else?
>
> Best,
> Marcel
>
> Am 26.10.2019 22:23:05 schrieb commits at source.squeak.org <
> commits at source.squeak.org>:
> A new version of System was added to project The Inbox:
> http://source.squeak.org/inbox/System-ct.1120.mcz
>
> ==================== Summary ====================
>
> Name: System-ct.1120
> Author: ct
> Time: 26 October 2019, 10:22:46.213469 pm
> UUID: 7ed0a01b-5518-e24f-9ead-65e1789c94d4
> Ancestors: System-ct.1117
>
> Revise System-ct.1117 (concerning CommonRequestStrings): Fix wrong
> dependency and improve code formatting
>
> =============== Diff against System-ct.1117 ===============
>
> Item was changed:
> ----- Method: Utilities class>>initializeCommonRequestStrings (in category
> 'common requests') -----
> initializeCommonRequestStrings
> "Initialize the common request strings, a directly-editable list of
> expressions that can be evaluated from the 'do...' menu."
>
> CommonRequestStrings := StringHolder new contents: (
> + String streamContents: [:stream | self commonRequestBlocks
> + do: [:block | block decompile statements
> + do: [:statement | stream
> + nextPutAll: (statement shortPrintString
> + copyWithRegex: '\s+'
> + matchesReplacedWith: String space);
> + nextPut: $.]
> + separatedBy: [stream cr]]
> + separatedBy: [stream cr; nextPut: $-; cr]])
> - String streamContents: [:stream |
> - self commonRequestBlocks
> - do: [:block |
> - block decompile statements
> - do: [:statement |
> - statement veryShortPrintOn: stream.
> - stream nextPut: $.]
> - separatedBy: [stream cr]]
> - separatedBy: [stream cr; nextPut: $-; cr]])
>
> "Utilities initializeCommonRequestStrings"!
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20191206/f1281bbd/attachment.html>


More information about the Squeak-dev mailing list