Lazarus

Miscellaneous => Other => Topic started by: Ten_Mile_Hike on August 07, 2022, 01:54:52 am

Title: My confession - I am a Pascal sinner . Reply to this with your own Pascal sins.
Post by: Ten_Mile_Hike on August 07, 2022, 01:54:52 am
I never use "Try Except Finally"  in my code and I
don't read the documentation unless my code fails
compilation.

Go ahead and roast me...I can take it.
I will ask Niklaus Wirth for forgiveness in my prayers tonight.
Title: Re: My confession - I am a Pascal sinner . Reply to this with your own Pascal sins.
Post by: kapibara on August 07, 2022, 07:34:50 am
I have stored rows of text without commenting them out in the space after the units end.
Title: Re: My confession - I am a Pascal sinner . Reply to this with your own Pascal sins.
Post by: circular on August 07, 2022, 09:42:37 am
I have written procedures that span over countless screens.
Title: Re: My confession - I am a Pascal sinner . Reply to this with your own Pascal sins.
Post by: Thaddy on August 07, 2022, 11:11:55 am
Despite Wirth's intentions, I confess I often write bad code....(not THAT often)
In my days as an assistent teacher at university in 1981 (USCD PASCAL, APPLE II, but also Algol Vax/Vms) I seem to have been more careful? Dunno why, but I got some of it back...
Title: Re: My confession - I am a Pascal sinner . Reply to this with your own Pascal sins.
Post by: MarkMLl on August 07, 2022, 11:15:14 am
I sometimes use GOTO inside a CASE to simulate C-style behaviour:

Code: Pascal  [Select][+][-]
  1.  
  2. case ParamCount() of
  3.   1: begin
  4. // Special handling here for the one-parameter case, e.g. --help and --version.
  5. oneParam:
  6.         option(ParamStr(1))
  7.       end;
  8.   2: begin
  9. twoParam:
  10. // Special handling here for the two-parameter case.
  11.         option(ParamStr(2))
  12.         goto oneParam
  13.       end;
  14. ...
  15.  

MarkMLl
Title: Re: My confession - I am a Pascal sinner . Reply to this with your own Pascal sins.
Post by: dseligo on August 07, 2022, 11:17:07 am
I use global variables.
Title: Re: My confession - I am a Pascal sinner . Reply to this with your own Pascal sins.
Post by: Thaddy on August 07, 2022, 11:22:52 am
I use global variables.
I use local typed consts... I win?  ::)
Title: Re: My confession - I am a Pascal sinner . Reply to this with your own Pascal sins.
Post by: MarkMLl on August 07, 2022, 11:30:21 am
I use global variables.

So do the Lazarus developers: that's how IDE forms are stored.

MarkMLl
Title: Re: My confession - I am a Pascal sinner . Reply to this with your own Pascal sins.
Post by: Josh on August 07, 2022, 12:10:42 pm
not commenting important/complex code
not putting TODO in code  ( go on a break and you've forgot what is left )
using shortened /abbreviated names for variables and procedure (no idea what they mean later on)
and the opposite using long similar names for var/proc/func.
  MyComplexFunctionForAdding,MyComplexFunctionForDividing, takes forever to find them in codecomplettion, when
  AddMyComplexFunction,DivideMyComplexFunction comes up within a fewkeypresses.
Badly formatted code  that is hard  to   follow.
Using extended chars directly in strings (may not show if you edit on another system);
Using others peoples code snippets (unless you fully understand the logic and flow).


Title: Re: My confession – I am a Pascal sinner.
Post by: Kays on August 07, 2022, 12:30:06 pm
Forgive me, padre, but I have sinned with another programming language, producing lots of dirty code. I mean, I love Pascal, but then you see this new, young programming language… I feel repentant and have already begun programming a new piece of software just in Pascal.
Title: Re: My confession - I am a Pascal sinner . Reply to this with your own Pascal sins.
Post by: Martin_fr on August 07, 2022, 01:39:06 pm
I "do" Pascal.
Title: Re: My confession - I am a Pascal sinner . Reply to this with your own Pascal sins.
Post by: Thaddy on August 07, 2022, 01:51:03 pm
I "do" Pascal.
Yeah, right, with C quotes... Unacceptable on this forum.
Then again I always mix up C code with Pascal comments........
Title: Re: My confession - I am a Pascal sinner . Reply to this with your own Pascal sins.
Post by: Awkward on August 07, 2022, 02:22:38 pm
OMG! i found my sins! Macroses! like
Code: Pascal  [Select][+][-]
  1.   {$IFDEF MSWINDOWS}
  2.     {$DEFINE WinAPI := stdcall}
  3.   {$ELSE}
  4.     {$DEFINE WinAPI := cdecl}
  5.   {$ENDIF}
  6.  
or
Code: Pascal  [Select][+][-]
  1. const
  2.   CompileInfo = 'Compiled at '+{$I %DATE%}+' '+{$I %TIME%}+' with FPC v.'+{$I %FPCVERSION%};
  3.  
and i even has fun with experiment with SQLite.inc file view:
Code: Pascal  [Select][+][-]
  1. {$MACRO ON}
  2. {$IFDEF S}
  3.   {$DEFINE declareproc:=procedure}
  4.   {$DEFINE asproc:=}
  5.   {$DEFINE declarefunc:=function}
  6.   {$DEFINE asfunc:=}
  7.   {$DEFINE doexternal:=external Sqlite3Lib;}
  8. {$ELSE}
  9.   {$DEFINE declareproc:=var}
  10.   {$DEFINE asproc:=: procedure}
  11.   {$DEFINE declarefunc:=var}
  12.   {$DEFINE asfunc:=: function}
  13.   {$DEFINE doexternal:=}
  14. {$ENDIF}
  15. // original
  16. {$IFDEF S}function{$ELSE}var{$ENDIF}sqlite3_declare_vtab_1{$IFDEF D}: function{$ENDIF}
  17.   (db: pchar; zCreateTable: pansichar): integer; cdecl;{$IFDEF S}external Sqlite3Lib;{$ENDIF}
  18.  
  19. declarefunc sqlite3_declare_vtab_2 asfunc (db: pchar; zCreateTable: pansichar): integer; cdecl; doexternal
  20.  
but really, i don't use it too actively
Title: Re: My confession - I am a Pascal sinner . Reply to this with your own Pascal sins.
Post by: MarkMLl on August 07, 2022, 02:30:10 pm
@Awkward: Nothing wrong with macros and predefined substitutions per se.

You would, OTOH, be living dangerously if you added your voice to those who complain that macros should support parameters >:-)

MarkMLl
Title: Re: My confession - I am a Pascal sinner . Reply to this with your own Pascal sins.
Post by: marcov on August 08, 2022, 02:22:51 pm
OMG! i found my sins! Macroses! like
Code: Pascal  [Select][+][-]
  1.   {$IFDEF MSWINDOWS}
  2.     {$DEFINE WinAPI := stdcall}
  3.   {$ELSE}
  4.     {$DEFINE WinAPI := cdecl}
  5.   {$ENDIF}
  6.  

Your sin is doing it manually, while it is a builtin feature (https://wiki.freepascal.org/FPC_New_Features_3.2.0#Support_for_WinAPI_directive)
Title: Re: My confession - I am a Pascal sinner . Reply to this with your own Pascal sins.
Post by: MarkMLl on August 08, 2022, 02:48:27 pm
Your sin is doing it manually, while it is a builtin feature (https://wiki.freepascal.org/FPC_New_Features_3.2.0#Support_for_WinAPI_directive)

...which is NBG if for some reason he also needs to support older compiler versions. Now he could obviously check against FPC_FULLVERSION to make sure that he'd got 3.2, but before doing that he'd also, in principle, have to check that he'd got at least 2.2.4 which is where FPC_FULLVERSION came in.

So I, for one, am certainly not criticising him.

MarkMLl
Title: Re: My confession - I am a Pascal sinner . Reply to this with your own Pascal sins.
Post by: Zvoni on August 08, 2022, 02:59:39 pm
I have to code in Visual Basic (Office-VBA) at work......
Title: Re: My confession - I am a Pascal sinner . Reply to this with your own Pascal sins.
Post by: marcov on August 08, 2022, 03:44:35 pm
Your sin is doing it manually, while it is a builtin feature (https://wiki.freepascal.org/FPC_New_Features_3.2.0#Support_for_WinAPI_directive)

...which is NBG if for some reason he also needs to support older compiler versions.

To my knowledge typically only a quite a small number of people still use the previous major version compiler at this point in the major release circle. (say roughly at the x.y.4 point, as 3.2.2 is well established now)
Title: Re: My confession - I am a Pascal sinner . Reply to this with your own Pascal sins.
Post by: Awkward on August 08, 2022, 03:57:16 pm
Your sin is doing it manually, while it is a builtin feature (https://wiki.freepascal.org/FPC_New_Features_3.2.0#Support_for_WinAPI_directive)

...which is NBG if for some reason he also needs to support older compiler versions.

To my knowledge typically only a quite a small number of people still use the previous major version compiler at this point in the major release circle. (say roughly at the x.y.4 point, as 3.2.2 is well established now)

Ah, now i understands why commented some time ago that macro in my code...
Title: Re: My confession - I am a Pascal sinner . Reply to this with your own Pascal sins.
Post by: MarkMLl on August 08, 2022, 04:03:36 pm
To my knowledge typically only a quite a small number of people still use the previous major version compiler at this point in the major release circle. (say roughly at the x.y.4 point, as 3.2.2 is well established now)

The significance of "quite small" can be argued in any context. Only a "quite small" number of people use Pascal, but I'm sure that they would be very unhappy indeed if e.g. Linux started to mandate code signing and the developers only supported majority languages.

The specific case I was thinking of though would be if somebody needed to support multiple distro versions which bundled multiple versions of libqtpas for Qt support, which would have implications on the versions of the LCL hence IDE hence compiler to be supported.

But in any event, it is- IMO- completely unacceptable for a program to fail to compile on even an ancient compiler version, without a sensible error message explaining /why/. In fact I'd go so far as to say that that would be a far graver sin than anybody had admitted to so far.

MarkMLl
Title: Re: My confession - I am a Pascal sinner . Reply to this with your own Pascal sins.
Post by: marcov on August 08, 2022, 05:49:59 pm
To my knowledge typically only a quite a small number of people still use the previous major version compiler at this point in the major release circle. (say roughly at the x.y.4 point, as 3.2.2 is well established now)

The significance of "quite small" can be argued in any context. Only a "quite small" number of people use Pascal, but I'm sure that they would be very unhappy indeed if e.g. Linux started to mandate code signing and the developers only supported majority languages.

As preprocessor usage goes above language level token processing, I don't understand that analogy. This is just a hint to cut ancient dead wood at a time when pretty much migrated to 3.2.x.

Quote
The specific case I was thinking of though would be if somebody needed to support multiple distro versions which bundled multiple versions of libqtpas for Qt support, which would have implications on the versions of the LCL hence IDE hence compiler to be supported.

Such things hardly make sense since in such LTS situations, most code is also frozen with it, and pretty much immutable except for emergencies.

Title: Re: My confession - I am a Pascal sinner . Reply to this with your own Pascal sins.
Post by: Ten_Mile_Hike on August 13, 2022, 11:24:35 pm
After reading all the replies to my original post I hereby declare all of you here to be "Wirthy" of forgiveness
TinyPortal © 2005-2018