Recent

Author Topic: Musing about too many comment types in Pascal...  (Read 2476 times)

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 1329
  • Professional amateur ;-P
Musing about too many comment types in Pascal...
« on: August 04, 2025, 09:36:23 am »
Hey Y'All,

This is more of a thought experiment than anything else. It's more of a comic relief than a serious proposal!!
But.... It could be a serious thing, if enough traction is gathered ;)

With that said... On the Discord server @socialmediarefugee and me where having an exchange about Pascal having too many comment types. As you do :D
After some back and forth, they suggested that we should not have { } as another comment type, but actually dedicate it exclusively to directives.

Once I saw the beauty of { if }...{ else }..{ endif }, with proper spacing and no feeling of unbalanced parens, I was hooked!!!
ACTUALLY... They even suggested we could extend it to have more than one directive:
Code: Pascal  [Select][+][-]
  1. {
  2.   mode objfpc
  3.   H+
  4.   switch functionreferences
  5.   switch sumtypes
  6. }
This alone would make it worthy to consider!!!

Or to make it even more Pascal cosy:
Code: Pascal  [Select][+][-]
  1. {
  2.   mode objfpc;
  3.   H+;
  4.   switch functionreferences;
  5.   switch sumtypes;
  6. }
Cuz, why not, amirite?!

Maybe I'm still riding the high of the Tera Template Engine I just ported where all is {{ .. }} and {% .. %}. And, yes, those extra spaces are optional, but they make it quite readable!!

Yeah... Drop your opinion on the comments ;)

Cheers,
Gus
Lazarus 4.99(main) FPC 3.3.1(main) Ubuntu 25.04 64b Dark Theme
http://github.com/gcarreno

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12531
  • FPC developer.
Re: Musing about too many comment types in Pascal...
« Reply #1 on: August 04, 2025, 09:53:18 am »
Compatibility must not be compromised. Free Pascal is a production compiler, not a language research experiment.

(and besides that I think the extension has no value. )

eny

  • Hero Member
  • *****
  • Posts: 1648
Re: Musing about too many comment types in Pascal...
« Reply #2 on: August 04, 2025, 09:59:52 am »
I wonder if other languages also trigger so many useless ideas about 'improving' the language  :'(
All posts based on: Win10 (Win64); Lazarus 3_4  (x64) 25-05-2024 (unless specified otherwise...)

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 1329
  • Professional amateur ;-P
Re: Musing about too many comment types in Pascal...
« Reply #3 on: August 04, 2025, 10:05:13 am »
Hey Marco,

Compatibility must not be compromised. Free Pascal is a production compiler, not a language research experiment.

(and besides that I think the extension has no value. )

I'm now wondering if you're one of those people that was born without a funny bone :D
I DID preamble the post with the fact that this is a thought experiment with a comic relief side.

While I do agree that the grouping of the directives would be a rather nice improvement to have, I'm not dead serious about it.
And, even in the realm of hypotheticals, this should not get such a serious answer ;)

I'm deeply sorry if this was not the kind of humour you appreciate. I did not want to incur in anyone's anger, least your own!!

EDIT: Us older folk tend to get quite goofy at the end of our awake cycle. This is usually the kind of ludicrous and out of the box things that are shot around when we're a bit high on the sleep deprivation drug ;)

Cheers,
Gus
« Last Edit: August 04, 2025, 10:09:57 am by Gustavo 'Gus' Carreno »
Lazarus 4.99(main) FPC 3.3.1(main) Ubuntu 25.04 64b Dark Theme
http://github.com/gcarreno

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 1329
  • Professional amateur ;-P
Re: Musing about too many comment types in Pascal...
« Reply #4 on: August 04, 2025, 10:06:13 am »
Hey Eny,

I wonder if other languages also trigger so many useless ideas about 'improving' the language  :'(

Hummm.... that's just mean. Sorry to say.

Cheers,
Gus
Lazarus 4.99(main) FPC 3.3.1(main) Ubuntu 25.04 64b Dark Theme
http://github.com/gcarreno

Khrys

  • Sr. Member
  • ****
  • Posts: 342
Re: Musing about too many comment types in Pascal...
« Reply #5 on: August 04, 2025, 10:11:10 am »
Yeah... Drop your opinion on the comments ;)

Hard disagree  ;D

Like @marcov said, this would completely break compatibility in a fundamental way.
Besides, do you not recognize the value inline comments provide? I think they look very clean with { },  much cleaner than C's  /* */  (or FPC's  (* *)  for that matter).

IMHO compiler directives are an implementation detail and should not take precedence over standard language features.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12531
  • FPC developer.
Re: Musing about too many comment types in Pascal...
« Reply #6 on: August 04, 2025, 10:19:21 am »
I'm now wondering if you're one of those people that was born without a funny bone :D

Or maybe I just reserve that for a comedy forum  O:-)


Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 1329
  • Professional amateur ;-P
Re: Musing about too many comment types in Pascal...
« Reply #7 on: August 04, 2025, 10:28:56 am »
Hey Khrys,

Yeah... Drop your opinion on the comments ;)

Hard disagree  ;D

That's the spirit!!! :D

Like @marcov said, this would completely break compatibility in a fundamental way.

Indeed, I DO have to agree that this is quite the breaking upheaval!! Hence me doing a bit of standup comedy. And quite a bad one, for that matter ;)

Besides, do you not recognize the value inline comments provide? I think they look very clean with { },  much cleaner than C's  /* */  (or FPC's  (* *)  for that matter).

I agree with you on the fact that { } as a comment, looks good. They are balanced.
My gripe is more with the unbalanced {$ }. That irks me a tad :)

IMHO compiler directives are an implementation detail and should not take precedence over standard language features.

Putting my serious hat on: Yeah, agreed !!

And playing devil's advocate:
Still, a fun thought experiment, amirite?!
Even if the only thing we would get out of all this argument would be grouping of directives!! We could even think about some other block delimiter for this... I dunno...
Maybe something like:
Code: Pascal  [Select][+][-]
  1. {$
  2.   mode objfpc;
  3.   H+;
  4.   switch this;
  5.   switch that;
  6. $}
Although, introducing this at the parser level... Maybe a bit of a nightmare  :-[
I REALLY fell in love with directive grouping, is all !!!

Cheers,
Gus
« Last Edit: August 04, 2025, 10:36:38 am by Gustavo 'Gus' Carreno »
Lazarus 4.99(main) FPC 3.3.1(main) Ubuntu 25.04 64b Dark Theme
http://github.com/gcarreno

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 1329
  • Professional amateur ;-P
Re: Musing about too many comment types in Pascal...
« Reply #8 on: August 04, 2025, 10:30:10 am »
Hey Marco,

I'm now wondering if you're one of those people that was born without a funny bone :D

Or maybe I just reserve that for a comedy forum  O:-)

The only reply has to be: Touché, kind Sir, touché !!! :D

Cheers,
Gus
Lazarus 4.99(main) FPC 3.3.1(main) Ubuntu 25.04 64b Dark Theme
http://github.com/gcarreno

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 1329
  • Professional amateur ;-P
Re: Musing about too many comment types in Pascal...
« Reply #9 on: August 04, 2025, 02:01:05 pm »
Hey Y'all,

The Discord is an ever revolving door of people from all time zones. And now that it's daytime in the European time zone, I got another suggestion from someone, that I'll usurp and present:
Code: Pascal  [Select][+][-]
  1. ${
  2.   mode objfpc;
  3.   H+;
  4.   switch this;
  5.   switch that; // <== per the rules, last semi can be unused, and, obviously, we still can do nested one line comments, cuz... well just cuz !!
  6. }

Yeap, also something to eff up the parser with Hex literals, LOL !!!  :P
Although... Peeking for "$[0..9]" and "${" is not that hard, amirite? No weird branching. And no breaking a ton of past code. Just another option in terms of the directive's syntax. At least until we can finally deprecate the previous "{$mode objfpc}" option!!

Cheers,
Gus

P.S.: Michael, eat your heart out :P ;)
Lazarus 4.99(main) FPC 3.3.1(main) Ubuntu 25.04 64b Dark Theme
http://github.com/gcarreno

AlanTheBeast

  • Sr. Member
  • ****
  • Posts: 407
  • My software never cras....
Re: Musing about too many comment types in Pascal...
« Reply #10 on: August 04, 2025, 02:32:00 pm »

Thread HIJACKING IN PROGRESS.

Arguing about the nonsense above when serious consideration to adding 'step' to the for loop statement should take precedence is a waste of time!

Everyone talks about the weather but nobody does anything about it.
..Samuel Clemens.

sfeinst

  • Sr. Member
  • ****
  • Posts: 250
Re: Musing about too many comment types in Pascal...
« Reply #11 on: August 04, 2025, 02:43:20 pm »
With that said... On the Discord server @socialmediarefugee and me where having an exchange about Pascal having too many comment types.

And yet with all those comment types, it is still difficult to get some coders to comment their code :)

440bx

  • Hero Member
  • *****
  • Posts: 5814
Re: Musing about too many comment types in Pascal...
« Reply #12 on: August 04, 2025, 02:48:16 pm »

Thread HIJACKING IN PROGRESS.

Arguing about the nonsense above when serious consideration to adding 'step' to the for loop statement should take precedence is a waste of time!
Adding "step" to the "for" loop isn't something I consider worth serious consideration.  Yes, it would make the loop a bit more obvious when that feature is needed but, it is rarely needed.   It's hard to approve of spending time adding a feature that is needed once in a blue moon.

I'd much rather see the compiler not considering an HWND assignable to an HMODULE assignable to an HPALETTE assignable to an HREGION assignable to an HBITMAP and so on.  That is much more useful and needed because there are quite a few functions that take parameters that if inadvertently reversed cause errors/bugs and the compiler is of no help whatsoever.  So much for "strong type" checking.



And yet with all those comment types, it is still difficult to get some coders to comment their code :)
Now, THAT is good comment :)

FPC v3.2.2 and Lazarus v4.0rc3 on Windows 7 SP1 64bit.

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 1329
  • Professional amateur ;-P
Re: Musing about too many comment types in Pascal...
« Reply #13 on: August 04, 2025, 02:55:17 pm »
Hey Alan,


Thread HIJACKING IN PROGRESS.

Arguing about the nonsense above when serious consideration to adding 'step' to the for loop statement should take precedence is a waste of time!

Bahhhh, humbug !!! Are you another one that has no funny bone, or reserve your funny bone to the comedy forums? :P :D

Cheers,
Gus
Lazarus 4.99(main) FPC 3.3.1(main) Ubuntu 25.04 64b Dark Theme
http://github.com/gcarreno

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 1329
  • Professional amateur ;-P
Re: Musing about too many comment types in Pascal...
« Reply #14 on: August 04, 2025, 02:56:30 pm »
Hey sfeinst,

And yet with all those comment types, it is still difficult to get some coders to comment their code :)

This, literally, put a smile on my face!!! That's the spirit !!!

EDIT: And, if I'm honest: Guilty as charged !!  :-[ :D

Cheers,
Gus
« Last Edit: August 04, 2025, 02:59:16 pm by Gustavo 'Gus' Carreno »
Lazarus 4.99(main) FPC 3.3.1(main) Ubuntu 25.04 64b Dark Theme
http://github.com/gcarreno

 

TinyPortal © 2005-2018