[squeak-dev] Compiling whitespaces (was: The Inbox: Compiler-ct.418.mcz)

Thiede, Christoph Christoph.Thiede at student.hpi.uni-potsdam.de
Thu Feb 20 08:22:52 UTC 2020


Hi all,


> using pretty-print just before saving your methods?  It already does that for you.  In fact, it even removes any comments at the end, which I DON'T like...

How can I reproduce this?

> I've yet to find a pretty printer I can live with.  They all fuck up my code.

Without ever having worked a long time with any pretty printer, I venture to claim that there cannot be a perfect pretty printer, at least not for Smalltalk: IMHO, the right way to indent a method, to decide how long a line should be, depends on many circumstances. How long are the lines in the rest of the class or module? If I write a method for etoys, I will probably put a short #ifTrue:ifFalse: statement into one line, because it fits the overall code appearance of etoys. However, if I write a similar method for Metacello, which consists of many wonderful short methods, I will likely spread the same statement over three, if not five lines. It depends on the context. Plus, I would rather compress secondary edge cases a bit more than the primary core logic. A pretty printer cannot know these things without a semantical analysis, I suppose.

> I don't put blank lines at the end, but I want to be able to, if I want to.  Formatting should remain a separate gesture from saving.  Please don't silently save my code differently than what I thought I saved.

+1. Another argument for not forcing to change the code by compiler is that otherwise, it would be tricky to restore older versions of a method which then needs to be recompiled?

> Re: multiline comments, I strongly prefer multiline comments to be a single uniform paragraph and not a series of 'formatted' lines.  If you don't care for your comments to wrap fully back to the left margin, how about we handle it by the rendering of CodeHolder, and not making your comments difficult to write, edit, and certainly harder to read when whatever margin you chose is too wide for the viewer (causing half-line wraps every other line), or rather narrow which forces them to scroll further vertically unnecessarily.  Inserting a bunch of successive spaces and/or tabs just to make paragraphs really complexifies comments.

+1000! ;-) It is really inaesthetic to read a method displayed like this:
[cid:1092680e-ea6a-4918-b65a-ff24f9183c98]

Best,
Christoph

________________________________
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Chris Muller <ma.chris.m at gmail.com>
Gesendet: Donnerstag, 20. Februar 2020 01:00:06
An: Eliot Miranda
Cc: The general-purpose Squeak developers list
Betreff: Re: [squeak-dev] Compiling whitespaces (was: The Inbox: Compiler-ct.418.mcz)

Eliot,

On Wed, Feb 19, 2020 at 1:53 PM Eliot Miranda <eliot.miranda at gmail.com<mailto:eliot.miranda at gmail.com>> wrote:


On Wed, Feb 19, 2020 at 11:10 AM Chris Muller <asqueaker at gmail.com<mailto:asqueaker at gmail.com>> wrote:
-1.  You mean you're not using pretty-print just before saving your methods?  It already does that for you.  In fact, it even removes any comments at the end, which I DON'T like...

I've yet to find a pretty printer I can live with.  They all fuck up my code.

Since I know you like Rectangular Block, I thought you'd like mine which I keep in the inbox.  It's not perfect, but very good, IMO, have you tried it?

No pretty printer deals with comments split across lines properly.

Mine does exactly the right thing which is to **not touch their contents**.

There are too many edge cases.  Comments need to be formatted (see Behavior>>instSpec for an example).  Pretty printers appear to be god solutions in theory, but in practice they're half-assed.

Some strong words...

Code highlighting, on the other hand, rocks. (Christoph, I can't wait to use requestCode:, very cool idea).

Is that the same as syntax highlighting?



Formatting and saving should remain two separate gestures, commingling them would be surprising and frustrating, IMO...

I'm not suggesting commingling them.  All i'm suggesting is stripping trailing white-space on passing code to compile:classified: et al (and *not* in compile:classified:).

I don't put blank lines at the end, but I want to be able to, if I want to.  Formatting should remain a separate gesture from saving.  Please don't silently save my code differently than what I thought I saved.

Please simply change your pretty-printer to do NOTHING else than that.  Then it won't be "half-assed" anynmore, yes?   :)
_______
Re: multiline comments, I strongly prefer multiline comments to be a single uniform paragraph and not a series of 'formatted' lines.  If you don't care for your comments to wrap fully back to the left margin, how about we handle it by the rendering of CodeHolder, and not making your comments difficult to write, edit, and certainly harder to read when whatever margin you chose is too wide for the viewer (causing half-line wraps every other line), or rather narrow which forces them to scroll further vertically unnecessarily.  Inserting a bunch of successive spaces and/or tabs just to make paragraphs really complexifies comments.

 - Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200220/0df1b640/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedImage.png
Type: image/png
Size: 72865 bytes
Desc: pastedImage.png
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200220/0df1b640/attachment-0001.png>


More information about the Squeak-dev mailing list