The main reason why I dont bother to use the reformatter is because of the
manner in which it MOVES my comments !! As a programmer of the old school I believe that comments IN CODE are important and I place them where they are for a REASON ! I dont believe the code reformatter is so smart that it understand what my comments are for :-) So please don't shift them. -- Cheers, Brett |
Hi Brett,
brett s hallett a écrit : > The main reason why I dont bother to use the reformatter is because of the > manner in which it MOVES my comments !! I agree that the way comments are moved when formatting is quite strange. I still not have understood how the pattern work ... -- Valentin Guerlesquin -- [hidden email] -- -- www.ventury-networks.com valentin.vcf (188 bytes) Download Attachment |
Hi Valentin,
I dont think that there is a 'pattern' !, more like "how can I confuse the programmer the most" !! And stuff up his/her nicely layed out comments at the same time :-) Of course many "expert' STers believe that Smalltalk code is self documenting, well that myth was destroyed many years ago in the dark ages of COBOL, but "they" still cling to the concept. Bless 'em. On Monday 18 February 2008 10:42:38 am Valentin Guerlesquin wrote: > Hi Brett, > > brett s hallett a écrit : > > The main reason why I dont bother to use the reformatter is because of > > the manner in which it MOVES my comments !! > > I agree that the way comments are moved when formatting is quite > strange. I still not have understood how the pattern work ... > > > > -- Valentin Guerlesquin > -- [hidden email] -- Cheers, Brett |
In reply to this post by dragoncity
brett s hallett wrote:
> The main reason why I dont bother to use the reformatter is because of the > manner in which it MOVES my comments !! > > As a programmer of the old school I believe that comments IN CODE are > important and I place them where they are for a REASON ! > > I dont believe the code reformatter is so smart that it understand what my > comments are for :-) > > So please don't shift them. > The parsers in VW treat comments as lesser citizens than program text, this is something that could be fixed, probably at the expense of parsing speed. To all those making snide comments in this thread: I challenge you to create an algorithm that works in the general case, I think that is fundamentally impossible. As an exercise take some snippet of your code with comments and remove all the line-breaks. Now reformat it with your algorithm and tell me if you can make it work. Perhaps try it that the following code snippet: "this is a method:" foo "with a lot of comments in specific places" "foo blasts a gargle and returns the result wrapped in a SEP field" "last change: 20070218 - RH" "some temps:" | a b "here is c, do we need it?" c | "thats the ivars" "XXX CHECK ivar 'c'" a := self gargle blasted. b := SomeoneElsesProblem new "make this abstract please". c "XXX loose me" := b around: a. ^c I agree that comment handling by the formatter can be improved, but don't expect too much, the possibilities are fundamentally limited. R - |
Reinout,
Please don't get offended by my comments on comments ! I intended it as a light hearted observation on Smalltalk generally. On Monday 18 February 2008 8:22:12 pm Reinout Heeck wrote: > brett s hallett wrote: > > The main reason why I dont bother to use the reformatter is because of > > the manner in which it MOVES my comments !! > > > > As a programmer of the old school I believe that comments IN CODE are > > important and I place them where they are for a REASON ! > > > > I dont believe the code reformatter is so smart that it understand what > > my comments are for :-) > > > > So please don't shift them. > > The parsers in VW treat comments as lesser citizens than program text, > this is something that could be fixed, probably at the expense of > parsing speed. > > > > To all those making snide comments in this thread: I challenge you to > create an algorithm that works in the general case, I think that is > fundamentally impossible. I think your challange is a very interesting one especially since I dont have a algorithm !. Its all done by sight using layout techniques I have developed for myself -- but hardly anything special and I keep it simple. The general case is of course the most difficult. Apart from having my comments stuffed up, I dont have any major problems with what happens now. Although 'stacked "]]]]'s" on one line does ! I just stopped using the reformatter to avoid getting annoyed. :-) > > As an exercise take some snippet of your code with comments and remove > all the line-breaks. Why ? I think line-breaks ( and blank lines) are a part of my commenting technique to make code more readable. I know white space is often derided as a waste of space (sic) ! -- which is interesting because code separation is often the clearest way to highlight something of interest. > Now reformat it with your algorithm and tell me if > you can make it work. Perhaps try it that the following code snippet: > > > "this is a method:" foo "with a lot of comments in specific places" > > "foo blasts a gargle and returns the result wrapped in a SEP field" > "last change: 20070218 - RH" > > "some temps:" | a b "here is c, do we need it?" c | "thats the > ivars" "XXX CHECK ivar 'c'" > > a := self gargle blasted. > b := SomeoneElsesProblem new "make this abstract please". > c "XXX loose me" := b around: a. > ^c > > ============================================= tidied up by hand ============================================= > foo "this is a method: foo > with a lot of comments in specific places" > > "foo blasts a gargle and returns the result wrapped in a SEP field" > "last change: 20070218 - RH" > > "some temps:" > | a b c | "here is c, do we need it?" > "thats the ivars" "XXX CHECK ivar 'c' " > > a := self gargle blasted. > b := SomeoneElsesProblem new. "make this abstract please" > c := b around: a. "XXX loose me" > ^c. > ============================ Maybe Smalltalk needs a (new ?) definition of how comments can be placed, rather than just 'free form" placement ?? > > I agree that comment handling by the formatter can be improved, but > don't expect too much, the possibilities are fundamentally limited. > > R > - -- Cheers, Brett |
brett s hallett wrote:
> Why ? I think line-breaks ( and blank lines) are a part of my commenting > technique to make code more readable. I know white space is often derided > as a waste of space (sic) ! -- which is interesting because code separation is > often the clearest way to highlight something of interest. Some parsers classify comments as just another kind of whitespace. regardless the /only/ thing that formatters alter is whitespace which is at odds with your desire to have whitespace not altered. This nicely shows the fundamental 'impossibility' of doing reformatting while preserving your layout. > Maybe Smalltalk needs a (new ?) definition of how comments can be placed, > rather than just 'free form" placement ?? Wise words, I don't know if we'll like it but it does create an opportunity to get around the fundamental problem. R - |
Inline comments are challenge for an efficient code scanner; they can be
identified by exception rather than syntax rule. Another approach is to (conditionally) parse in two passes where one pass is used to extract comments for node notations. If parse nodes can be annotated with inline comments then the print strategy needs to know to explicitly look for these comments. Or, print strategy modification could be reduced by wrapping/decorating nodes with pre or post inline comments. Comments are often used for a temporary change. I've found automatic save reformatting most irritating when commenting out one cascaded message send to insert another. The reformat sticks the comment at the bottom; the message sequence is lost. The solution I found was to unload the AsYouLikeIt package. I don't have the time to make it right so I just make it go away. As implemented, the feature should not be on by default. Paul Baumann -----Original Message----- From: Reinout Heeck [mailto:[hidden email]] Sent: Monday, February 18, 2008 7:02 AM To: vwnc List Subject: Re: code reformatting angst brett s hallett wrote: > Why ? I think line-breaks ( and blank lines) are a part of my > commenting technique to make code more readable. I know white space is > often derided as a waste of space (sic) ! -- which is interesting > because code separation is often the clearest way to highlight something of interest. Some parsers classify comments as just another kind of whitespace. regardless the /only/ thing that formatters alter is whitespace which is at odds with your desire to have whitespace not altered. This nicely shows the fundamental 'impossibility' of doing reformatting while preserving your layout. > Maybe Smalltalk needs a (new ?) definition of how comments can be > placed, rather than just 'free form" placement ?? Wise words, I don't know if we'll like it but it does create an opportunity to get around the fundamental problem. R - -------------------------------------------------------- This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of IntercontinentalExchange, Inc. (ICE), its subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired. |
Free forum by Nabble | Edit this page |