Recent

Author Topic: What's the point with these auto generated comments {TForm1}  (Read 19729 times)

guest58172

  • Guest
What's the point with these auto generated comments {TForm1}
« on: August 17, 2016, 09:14:23 am »
Please tell us the story.

I tend to delete them but they're generated again and again; I always wandered why and today I dare asking.  :-[

shobits1

  • Sr. Member
  • ****
  • Posts: 271
  • .
Re: What's the point with these auto generated comments {TForm1}
« Reply #1 on: August 17, 2016, 10:09:39 am »
I think it is related to code auto completion generally not to TForm specifically, just tried an empty class with 1 procedure then Shif+Ctrl+C and the code auto completion and { tttt } (the name of the class).

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: What's the point with these auto generated comments {TForm1}
« Reply #2 on: August 17, 2016, 10:17:33 am »
There's no need to delete the autogenerated comments. Change the setting so they are not generated.
The setting is found in the IDE Options dialog on the Class Completion page (under Codetools node). It has separate checkboxes for
  •   Header comment for class
  •   Implementation comment for class

Thaddy

  • Hero Member
  • *****
  • Posts: 16945
  • Ceterum censeo Trump esse delendam
Re: What's the point with these auto generated comments {TForm1}
« Reply #3 on: August 17, 2016, 10:40:31 am »
As Howardpc wrote you can disable it, but I find it a useful means of navigating through code. It doesn't harm. It does not affect code.
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

BeniBela

  • Hero Member
  • *****
  • Posts: 927
    • homepage
Re: What's the point with these auto generated comments {TForm1}
« Reply #4 on: August 17, 2016, 02:21:46 pm »
Oh these were incredible annoying

After a while they start moving and end up at the wrong class

guest58172

  • Guest
Re: What's the point with these auto generated comments {TForm1}
« Reply #5 on: August 17, 2016, 07:23:38 pm »
There's no need to delete the autogenerated comments. Change the setting so they are not generated.
The setting is found in the IDE Options dialog on the Class Completion page (under Codetools node). It has separate checkboxes for
  •   Header comment for class
  •   Implementation comment for class
Thx, I couldn't stand them anymore.
BY the way they are probably the worst comments possible because they don't add any value:

Code: Pascal  [Select][+][-]
  1. private
  2.   {private declarations}
  3. public
  4.   {public declarations}
  5.  

No kidding...

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: What's the point with these auto generated comments {TForm1}
« Reply #6 on: August 17, 2016, 09:14:18 pm »
Yes, there's no option I know of to suppress their autogeneration.
In fact they're hard-coded.
See ($LazarusDir)/components/ideintf/projectintf.pas around line 1025.
I think that's long overdue for a change.

Graeme

  • Hero Member
  • *****
  • Posts: 1428
    • Graeme on the web
Re: What's the point with these auto generated comments {TForm1}
« Reply #7 on: August 18, 2016, 01:27:35 am »
BY the way they are probably the worst comments possible because they don't add any value:
Indeed, they are totally useless and annoying. Hopefully one day we can toggle that behaviour ON or OFF.
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4570
  • I like bugs.
Re: What's the point with these auto generated comments {TForm1}
« Reply #8 on: August 18, 2016, 05:20:56 pm »
Yes, the comments like:
Code: Pascal  [Select][+][-]
  1.   private
  2.     {private declarations}
  3.   public
  4.     {public declarations}
bother also me a lot.
I remember removing such leftover comments from existing code because they look so redundant and useless. Every Pascal programmer knows that after keyword "private" come private declarations and after "public" come public declarations.
Following that logic similar comments should be added after other keywords like "begin" and "end", too.
Code: Pascal  [Select][+][-]
  1. begin
  2. {block begins}
  3.   i:=0; j:=0;
  4. end;
  5. {block ends}

Clearly this is a historical remain from Delphi. Somebody added the auto-comments there at day one and then nobody thought of it.
Lazarus followed to be compatible...
I planning to do a bold move and remove such comment generation completely. If somebody really wants them configurable then I guess an option must be added. I am not very motivated to implement such an option because I have other useful things to do and there are too many options already anyway.
Patches for the option are welcome surely.

What do people think?
« Last Edit: August 18, 2016, 05:26:08 pm by JuhaManninen »
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: What's the point with these auto generated comments {TForm1}
« Reply #9 on: August 18, 2016, 05:30:48 pm »
The only possible value for those comments that I can see is for complete beginners to programming. Perhaps they could be left operational in the EducationLaz package (but perhaps that is a lot of work)?
Otherwise I think all others will breathe a sigh of relief, and express their thanks to BBasile for broaching the subject.

Graeme

  • Hero Member
  • *****
  • Posts: 1428
    • Graeme on the web
Re: What's the point with these auto generated comments {TForm1}
« Reply #10 on: August 18, 2016, 06:01:31 pm »
@Juha:
I'm all for deleting such useless comments outright. Go right ahead! :)
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: What's the point with these auto generated comments {TForm1}
« Reply #11 on: August 18, 2016, 07:48:56 pm »
Why not implement a very simple file load system for Project > New > Application which simply loads a copy of a .pas/.pp file from the config directory (as I think Mattias introduced for customising indentation etc.)? There could be a hard-coded fall-back in case the file was missing or corrupted.
Then users could easily set their basic project 'skeleton' (with as many or as few comments as they wanted) without the need for further IDE options.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4570
  • I like bugs.
Re: What's the point with these auto generated comments {TForm1}
« Reply #12 on: August 18, 2016, 09:07:15 pm »
I removed the comments in r52832. They were in many places.
I wrote a note also in Lazarus mailing list (which was rejected, must find out why).

@howardpc, your idea is good but I don't have time nor motivation to implement it now. Patches are welcome.
« Last Edit: August 18, 2016, 09:15:18 pm by JuhaManninen »
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

balazsszekely

  • Guest
Re: What's the point with these auto generated comments {TForm1}
« Reply #13 on: August 18, 2016, 09:27:41 pm »
Quote
@Juha
I wrote a note also in Lazarus mailing list (which was rejected, must find out why).
My mails are blocked for more then a year now. When I contacted mailman-owner@lists.lazarus.freepascal.org I got the following response:
Quote
You are not allowed to post to this mailing list, and your message has
been automatically rejected.  If you think that your messages are
being rejected in error, contact the mailing list owner at
mailman-owner@lists.lazarus.freepascal.org.
Which is kinda funny(contact me if necessary, but you will be blocked automatically anyway, so basically you cannot contact me)  :D

hnb

  • Sr. Member
  • ****
  • Posts: 270
Re: What's the point with these auto generated comments {TForm1}
« Reply #14 on: August 18, 2016, 09:28:24 pm »
I removed the comments in r52832. They were in many places.

Very sad news for me. That is part of long tradition. Pure logic is the ruin of the spirit.
Checkout NewPascal initiative and donate beer - ready to use tuned FPC compiler + Lazarus for mORMot project

best regards,
Maciej Izak

 

TinyPortal © 2005-2018