Recent

Author Topic: Why Pascal?  (Read 38750 times)

snorkel

  • Hero Member
  • *****
  • Posts: 817
Re: Why Pascal?
« Reply #75 on: May 11, 2018, 05:53:17 pm »
This is going to make me look super old, but I learned pascal back in college circa 1992, the University I went to had the core programming courses in pascal and then you took electives for other languages like C++
I used VB for awhile and it sucked and then Delphi came on the scene around 1995 and I immediately dropped VB like it was molten lava hahah.
The best part is on windows you can still to this day make single file exes that just work, no stupid java or .net runtimes etc needed.

I then dabbled with Lazarus and when it hit 1.0 in 2012 I ported everything I had to Lazarus and FPC and have not used Delphi since.

The big corporations are consumed with web development even though it is the most insecure way to develop, I hate web development as it can be hacked in a heartbeat even if your careful and implement a CRSF token system etc.
***Snorkel***
If I forget, I always use the latest stable 32bit version of Lazarus and FPC. At the time of this signature that is Laz 3.0RC2 and FPC 3.2.2
OS: Windows 10 64 bit

Zoran

  • Hero Member
  • *****
  • Posts: 1829
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: Why Pascal?
« Reply #76 on: May 11, 2018, 06:06:26 pm »
In C++ - depending on compiler settings - it is possible to change the value of a named constant within its scope. That is basically the same as Pascal.
The big difference between const and named/typed const is memory allocation. Named consts and typed consts have an address....

You keep stressing the implementation detail (where and how these are stored internally), which is rarely important to the programmer.

Yes, it is nice to know, but much more important for the programmer is to keep distinction between what can vary (a variable) and what is constant throughout its life within its scope (a constant).
The much cleaner syntax would be to use the keyword var for what can vary, and reserve the const keyword for what cannot. This is a high level language after all.

Thaddy

  • Hero Member
  • *****
  • Posts: 14201
  • Probably until I exterminate Putin.
Re: Why Pascal?
« Reply #77 on: May 11, 2018, 08:55:00 pm »
Zoran you miss the point for typed consts. It is actually a low-level construct that pre-dates Object Pascal and makes maintaining state - like fields of a class - between function.procedure calls possible.
It is NOT a var!
Code: Pascal  [Select][+][-]
  1. {{$WRITEABLECONST ON}
  2. function countme:integer;
  3. const i:integer = 0;
  4. begin;
  5.   inc(i);
  6.   Result := i;
  7. end;
  8. var k:integer;
  9. begin
  10.   for k:= 0 to 9 do
  11.     writeln(countme);
  12. end.
It is const in the sense that it is const, not writable, outside of the scope where it is declared. A var is reset every call.
Nothing new, nothing to do with Pascal as such. It is quite a common concept in computer science, not only compiler design, but e.g. also functional design.
There is already sufficient difference between a typed const and an untyped - really an inferred const which size is usually determined based on the CPU register size! - const. And even if writableconst is selected, it still is a memory location and NOT free for the compiler to substitute with a immediate constant value. Although optimization may choose otherwise when appropiate.. The latter is real implementation detail....
« Last Edit: May 11, 2018, 09:09:40 pm by Thaddy »
Specialize a type, not a var.

Zoran

  • Hero Member
  • *****
  • Posts: 1829
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: Why Pascal?
« Reply #78 on: May 11, 2018, 10:29:08 pm »
Zoran you miss the point for typed consts. It is actually a low-level construct that pre-dates Object Pascal and makes maintaining state - like fields of a class - between function.procedure calls possible.
It is NOT a var!
Code: Pascal  [Select][+][-]
  1. {{$WRITEABLECONST ON}
  2. function countme:integer;
  3. const i:integer = 0;
  4. begin;
  5.   inc(i);
  6.   Result := i;
  7. end;
  8. var k:integer;
  9. begin
  10.   for k:= 0 to 9 do
  11.     writeln(countme);
  12. end.
It is const in the sense that it is const, not writable, outside of the scope where it is declared. A var is reset every call.
Nothing new, nothing to do with Pascal as such. It is quite a common concept in computer science, not only compiler design, but e.g. also functional design.
There is already sufficient difference between a typed const and an untyped - really an inferred const which size is usually determined based on the CPU register size! - const. And even if writableconst is selected, it still is a memory location and NOT free for the compiler to substitute with a immediate constant value. Although optimization may choose otherwise when appropiate.. The latter is real implementation detail....

Okay... but still, other languages do treat it as a kind of a var, not const, don't they. At least C/C++ -- static variables, declared as other variables, without const, just static keyword).

Nevertheless, I'll try to accept this explanation you gave. After all, that is the way it has been in Pascal syntax for decades, so I accepted it long time ago, and there is not much point in going on opposing you further (which always presents a risk with a grumpy old man who has too many times proven himself superior to the plebs of this forum ;) ).

metis

  • Sr. Member
  • ****
  • Posts: 300
Re: Why Pascal?
« Reply #79 on: May 14, 2018, 12:37:22 pm »
@ASBzone
Quote
I also started learning C and C++...Nice languages, but nothing like Pascal for me...
+ For me, Pascal just happened to suit my personality, and has been quite capable of doing all that I have needed.
Though I did not try out or even learn so many ProgrammingLanguages as You did
(I'm a pure HobbyProgrammer - My Education and Profession has nothing to do with Programming, at all),
I agree with You a 100%.

I can read C/C++ w/o Problems, but I never felt any Stimulus to write a Programm with them.
For me C/C++ is like "interesting, but strange", while Pascal is like being at Home.
(really totally subjective Sentiment)


@engkin
Quote
it will be more like glorifying Pascal
Not necessarily, see here http://forum.lazarus-ide.org/index.php/topic,40803.msg285336.html#msg285336
-> What is missing in Pascal ?
-> What can not be done with Pascal without "big Detours" ?
(even if this Thread's Title is "Why Pascal?".)


@snorkel
Quote
I used VB for awhile and it sucked and then Delphi came...and I immediately dropped VB
+ I ported everything I had to Lazarus and FPC and have not used Delphi since.
Same with me.


@Zoran
Quote
but much more important for the programmer is to keep distinction between what can vary...and what is constant
Yes. :)

In General, so not only referring to ProgrammingIssues:
Of course, the Theory is important, but the Practice should be kept user-friendly, otherwise
People only get lost in Details, that are not important for every Day's Work, or more "programming-spoken":
A Front-End should be comprehensive and easy to use, even if the User doesn't know every Detail of the Back-End.
If somebody is interested in getting deeper into the Theorie behind, he may do so, but it should not be obligatory.
-> Stil for me naming something (in the Front-End) a "Constant", that is actually variable, is misleading.

Just imagine, what would happen, if every Lazarus- or Pascal-User should learn Assembler first. %)
I suppose, even this Forum would be quite empty.
« Last Edit: May 14, 2018, 12:38:57 pm by metis »
Life could be so easy, if there weren't those f*** Details.
My FFmpeg4Lazarus = FFPlay4Laz + FFGrab4Laz + FFInfo4Laz

Thaddy

  • Hero Member
  • *****
  • Posts: 14201
  • Probably until I exterminate Putin.
Re: Why Pascal?
« Reply #80 on: May 14, 2018, 03:38:09 pm »
No it would not be empty at all:
Well there's a skew towards 45+ in age distribution, so yes, probably a majority has assembler knowledge. And indeed very few started with assembler but these old men switched soon to assembler to get around limitations and make the most of the hardware that was current for their personal use. Like Atari's, C64, BBC Micro, ZX80/81/spectrum and the likes. Just like these guys are all running at least one Raspberry Pi.... :-[ :o O:-) (Hardly using assembler for the ARM). I was quite happy to type in 7 pages of densely printed hexadecimals from a magazine to have my dose of gaming.... :D That's in theory, these 7 pages: I have not built in error correcting code like crc32....You'll learn it the hard way...
« Last Edit: May 14, 2018, 03:47:55 pm by Thaddy »
Specialize a type, not a var.

metis

  • Sr. Member
  • ****
  • Posts: 300
Re: Why Pascal?
« Reply #81 on: May 14, 2018, 05:46:37 pm »
Once upon a Time, the biggest Problem in big Towns was the Pollution
caused by the Quantity of Coaches drawn by Horses.
Nowadays, big Towns still have the same Problems, but not because of Horses.
 ;)
Life could be so easy, if there weren't those f*** Details.
My FFmpeg4Lazarus = FFPlay4Laz + FFGrab4Laz + FFInfo4Laz

Thaddy

  • Hero Member
  • *****
  • Posts: 14201
  • Probably until I exterminate Putin.
Re: Why Pascal?
« Reply #82 on: May 14, 2018, 06:24:56 pm »
Actually, nowadays horses are welcome in city centers because -while they pollute in a more visible way - their environmental footprint is less than a truck with a Diesel engine.
Unless it is a German horse. In that case it needs re-testing.....
« Last Edit: May 14, 2018, 06:28:47 pm by Thaddy »
Specialize a type, not a var.

metis

  • Sr. Member
  • ****
  • Posts: 300
Re: Why Pascal?
« Reply #83 on: May 14, 2018, 07:06:05 pm »
1. One Truck is equal to about 300-500 Horses.
2. I still prefer a fast, cosy car to a Horse.
3. I never liked Diesel.
4. Other Manufacturer like from Japan or Italy got the same Problem.
(Have to leave my work place, sorry)  :)
« Last Edit: May 14, 2018, 07:07:36 pm by metis »
Life could be so easy, if there weren't those f*** Details.
My FFmpeg4Lazarus = FFPlay4Laz + FFGrab4Laz + FFInfo4Laz

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: Why Pascal?
« Reply #84 on: May 14, 2018, 08:29:30 pm »
-> What is missing in Pascal ?

Not much. I think the language suffers more from new extensions (whose applications are successively more rare, and orthogonality suffers).

Moreover, new features are already introduced while the older never are really finished, and then I mean mainly the library part.

Quote
-> What can not be done with Pascal without "big Detours" ?
(even if this Thread's Title is "Why Pascal?".)

Barring things that Pascal is not a scripting language: not much. Of course "big" is subjective.

But IMHO the problems, but also the reasons for me to use FPC/Lazarus are not in language. Once the language is sufficiently evolved enough, the attractions and problems are outside the language.

One can navel gaze at infinitum on language features, but that doesn't solve anything.

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Why Pascal?
« Reply #85 on: May 15, 2018, 02:19:52 am »
For me C/C++ is like "interesting, but strange", while Pascal is like being at Home.
(really totally subjective Sentiment)

I once heard the transition from C to C++ as being like nailing extra legs onto a dog and calling it an octopus.

And I agree, I once called myself a C programmer (yeah, in your dreams Davo) but could never handle the transition to C++, its object model just had too many things going on and you could never be sure you were seeing the big picture.

On the other hand, the Pascal object model seems initially simple and manageable but still has a rich environment beyond that initial learning curve. And it suits (eg) LCL beautifully.

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

Thaddy

  • Hero Member
  • *****
  • Posts: 14201
  • Probably until I exterminate Putin.
Re: Why Pascal?
« Reply #86 on: May 15, 2018, 12:26:29 pm »
I found an actual picture of how C++ looks like:
Specialize a type, not a var.

garlar27

  • Hero Member
  • *****
  • Posts: 652
Re: Why Pascal?
« Reply #87 on: May 19, 2018, 01:04:53 am »
I found an actual picture of how C++ looks like:

+1

Guser979

  • New Member
  • *
  • Posts: 40
Re: Why Pascal?
« Reply #88 on: August 29, 2021, 08:06:23 pm »
Because if I'm not a programmer and I can produce tools that really help in my daily activities (and that's what interests me) using graphics, databases, communication, mobile-desktop integration and all that in an absurdly short time.... God. .. I wonder what a programmer can do.

 

TinyPortal © 2005-2018