Recent

Author Topic: Effective FreePascal book or cookbook for FPC?  (Read 3939 times)

Warfley

  • Hero Member
  • *****
  • Posts: 1851
Re: Effective FreePascal book or cookbook for FPC?
« Reply #15 on: May 20, 2023, 12:50:19 pm »
Just for anyone who might be interested, I use the following form:
Code: Pascal  [Select][+][-]
  1. function QuiteALongName
  2.            (
  3.             constref Param1: TParam1;
  4.                const Param2: TParam2;
  5.                      Param3: TParam3;
  6.                  var Param4: TParam4
  7.            )
  8.          : TResultType;
  9. begin
  10.   <indented code>
  11. end;

....
The indentatiion of the parameters like this is something that I had also used in the past, but Lazarus hates you when you do this. Lazarus tries to (if there is no overriding rule like start of begin/end) always indent to the previous line, and when you are that far away from the start of the line, the indentation when pressing tab goes crazy and makes giant leaps.

So sometimes laziness just wins and I stick to what doesn't make me want to throw my PC out the window

440bx

  • Hero Member
  • *****
  • Posts: 4895
Re: Effective FreePascal book or cookbook for FPC?
« Reply #16 on: May 20, 2023, 08:32:33 pm »
Lazarus hates you when you do this. Lazarus tries to (if there is no overriding rule like start of begin/end) always indent to the previous line, and when you are that far away from the start of the line, the indentation when pressing tab goes crazy and makes giant leaps.
I don't let Lazarus do any indenting/formatting.  I don't normally use it to edit code anyway, I use my regular editor which saves the source file(s) automatically when switching to another program and Lazarus detects the file changes automatically.  That's very convenient.

(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Curt Carpenter

  • Hero Member
  • *****
  • Posts: 576
Re: Effective FreePascal book or cookbook for FPC?
« Reply #17 on: May 20, 2023, 10:00:13 pm »
For those of us that started with a few boxes of punched cards and a tablet of 80-column coding forms, all that white space is still alarming (old habits die hard).   Although hitting the space bar on a keypunch made a satisfying machine-gun like sound... 

440bx

  • Hero Member
  • *****
  • Posts: 4895
Re: Effective FreePascal book or cookbook for FPC?
« Reply #18 on: May 20, 2023, 10:25:42 pm »
For those of us that started with a few boxes of punched cards and a tablet of 80-column coding forms
I am among those.  IBM 360, I don't remember the model number of the punch card machine but, I do remember that the most used key was probably the "dup" key.... <chuckle>  Of course, the program was handed over to an operator, direct access to the mainframe was usually out of the question.  How times have changed.

with punch cards the only way to see more than one line of code at a time was to get a listing from the computer.  These days, depending on the monitor one is using, it is possible to see over a 100 lines.  That really makes a few lines of whitespace be a secondary concern particularly if their presence makes the code easier to read/understand.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Joanna from IRC

  • Hero Member
  • *****
  • Posts: 1278
Re: Effective FreePascal book or cookbook for FPC?
« Reply #19 on: May 21, 2023, 12:02:41 am »
If you are coming to pascal from another language might I suggest something that is not a book that might be helpful?

Lazarus has sample programs you can look at to see how it is done.
✨ 🙋🏻‍♀️ More Pascal enthusiasts are needed on IRC .. https://libera.chat/guides/ IRC.LIBERA.CHAT  Ports [6667 plaintext ] or [6697 secure] channel #fpc  #pascal Please private Message me if you have any questions or need assistance. 💁🏻‍♀️

ikel

  • New Member
  • *
  • Posts: 36
Re: Effective FreePascal book or cookbook for FPC?
« Reply #20 on: May 22, 2023, 01:54:19 am »
If you are coming to pascal from another language might I suggest something that is not a book that might be helpful?

Lazarus has sample programs you can look at to see how it is done.

Thanks Joanna. Old habits die hard. I'm using FPC + Lazarus more at work.
Coming from Java and C++, I could not help but think .. what are the pitfalls if I do this, or that. Hence, my earlier question.
I will check more examples of FPC and Lazarus.

-ikel

 

TinyPortal © 2005-2018