* * *

Author Topic: Why Pascal?  (Read 14234 times)

tverweij

  • Guest
Re: Why Pascal?
« Reply #15 on: April 12, 2018, 11:55:50 am »
- structured
- strict
- readable
- case insensitive
- full pointer support
- full OOP (although multiple inheritance is missing)


Thaddy

  • Hero Member
  • *****
  • Posts: 6898
Re: Why Pascal?
« Reply #16 on: April 12, 2018, 12:57:13 pm »
And a very strict separation of declaration and implementation throughout the language, which makes it not only easier to read but also less prone to errors than C like languages that allow e.g. variable declarations within a code block... even on the fly.... which is silly although it "saves time"..<think!  >:D >.
A variable declaration is much more readable and strict because of that separation. It prevents errors although it may seem more verbose. Same goes for types. Same goes for clumsy enumerations in other languages. Same goes for - native - sets.

Btw: multiple inheritance is supported through interfaces...
There are more languages with these strict features. Almost all of them are Wirthian languages which includes imo also ADA. Although COBOL has many of the same features I mentioned.
Ada's daddy wrote this:"Fools are my theme, let satire be my song."

segfault

  • Jr. Member
  • **
  • Posts: 60
Re: Why Pascal?
« Reply #17 on: April 15, 2018, 08:27:19 pm »
Same goes for - native - sets.

I think this is a much under-utilised and under-appreciated feature of the language. Well thought out use of sets can simplify many programs enormously and also makes them easier to read. I know you can implement them using bit vectors in pretty much any language, but how often would you actually do it? Having them native is a big plus.

fcu

  • New member
  • *
  • Posts: 19
Re: Why Pascal?
« Reply #18 on: April 15, 2018, 10:18:24 pm »
variable declarations within a code block... even on the fly.... which is silly although it "saves time"..<think!  >:D >.

i find it very useful , better than scrolling every time to var region !

metis

  • Full Member
  • ***
  • Posts: 128
Re: Why Pascal?
« Reply #19 on: April 23, 2018, 04:25:48 pm »
@fcu

Quote
better than scrolling every time to var region !
Relax Your Forefinger, and jump instead:
Jump to the Var with <Alt+Up>, then jump back with <Ctrl+H>;)


@All the others
I love Lazarus and FPC.  :-*
It installs fast and w/o Problems (at least with me: WinXP SP3).
It is so easy to use, compiles and runs fast, and is full with useful Features, ...

Question:
Afaik, the first MacOs's had been written with Pascal.
-> Does anybody know, why, and why Pascal was left ?

Life could be so easy, if there weren't those f*** Details.

Phil

  • Hero Member
  • *****
  • Posts: 2750
Re: Why Pascal?
« Reply #20 on: April 23, 2018, 04:30:05 pm »

Afaik, the first MacOs's had been written with Pascal.
-> Does anybody know, why, and why Pascal was left ?

https://en.wikipedia.org/wiki/Object_Pascal#Early_history_at_Apple

RAW

  • Hero Member
  • *****
  • Posts: 675
Re: Why Pascal?
« Reply #21 on: April 23, 2018, 08:50:52 pm »
Quote
@All the others
I love Lazarus and FPC.  :-*
It installs fast and w/o Problems (at least with me: WinXP SP3).
It is so easy to use, compiles and runs fast, and is full with useful Features, ...

YES !!!! DEFINITELY !!!!

I really like the SECONDARY INSTALLATION...  :)
Windows 7 Pro (x64 Sp1) And Windows XP Pro (x86 Sp3) - LAZARUS 1.8.4 FPC 3.0.4 // 1.7 FPC 3.1.1

metis

  • Full Member
  • ***
  • Posts: 128
Re: Why Pascal?
« Reply #22 on: April 27, 2018, 03:08:52 pm »
@Phil

Referring to that article:
"Apple dropped support for Object Pascal when they moved from Motorola 68K chips to IBM's PowerPC
 architecture in 1994. MacApp 3.0, for this platform, was re-written in C++."

-> So far, so good, but why did they have to change the programming language,
     only because of changing the processor. Did Pascal not support it ?
     (Sorry for these questions, but I'm only a Hobby-Programmer).
Life could be so easy, if there weren't those f*** Details.

Zoran

  • Hero Member
  • *****
  • Posts: 1253
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: Why Pascal?
« Reply #23 on: April 27, 2018, 03:26:07 pm »
And a very strict separation of declaration and implementation throughout the language, which makes it not only easier to read but also less prone to errors than C like languages that allow e.g. variable declarations within a code block... even on the fly....

Ah, THE one argument I strongly disagree with.

I believe that declaring variable only in the block where it belongs is what actually makes code not only less prone to errors, but also easier to read.
"Don't declare variable outside of exact block they belong to" is what I really miss in Pascal.

.... which is silly although it "saves time"..<think!  >:D >.

And it is not about saving time.

Phil

  • Hero Member
  • *****
  • Posts: 2750
Re: Why Pascal?
« Reply #24 on: April 27, 2018, 03:44:05 pm »
-> So far, so good, but why did they have to change the programming language,
     only because of changing the processor. Did Pascal not support it ?

I don't know, but I'm sure you can research that and find out. That was before my time as a Mac user.

Apple has switched primary language several times. When they acquired NeXT and the OS / frameworks that would eventually become OS X and the Cocoa framework, they switched to Objective C. Then about four years ago they switched to their own homegrown Swift for all the Darwin platforms (macOS, iOS, tvOS, watchOS) as well as Linux.

Now Google has forked Swift for use with TensorFlow. Pretty impressive growth for barely 4 years in.

https://www.tensorflow.org/community/swift

Leledumbo

  • Hero Member
  • *****
  • Posts: 7958
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Why Pascal?
« Reply #25 on: April 28, 2018, 10:36:42 pm »
I believe that declaring variable only in the block where it belongs is what actually makes code not only less prone to errors, but also easier to read.
"Don't declare variable outside of exact block they belong to" is what I really miss in Pascal.
Quite the contrary, my experience with block level declaration makes my code buggier than the Pascal strict single declaration style. This is mainly due to the variable shadowing where you might unintentionally shadow the outer variable having the same name and type as the inner one and accidentally misrefer, either in outer or inner block. Not that often happen, but when it does, it really sucks to debug.

ASerge

  • Hero Member
  • *****
  • Posts: 942
Re: Why Pascal?
« Reply #26 on: April 29, 2018, 10:12:14 am »
I believe that declaring variable only in the block where it belongs is what actually makes code not only less prone to errors, but also easier to read.
"Don't declare variable outside of exact block they belong to" is what I really miss in Pascal.
Quite the contrary, my experience with block level declaration makes my code buggier than the Pascal strict single declaration style. This is mainly due to the variable shadowing where you might unintentionally shadow the outer variable having the same name and type as the inner one and accidentally misrefer, either in outer or inner block. Not that often happen, but when it does, it really sucks to debug.
Agreed. I prefer to do more complex logic in several blocks with nested functions. First, it is so easy in pascal. Second, a named block of code is very easy to understand and reduces the complexity of the code. And if you think about efficiency, "inline" will remove this issue.

Thaddy

  • Hero Member
  • *****
  • Posts: 6898
Re: Why Pascal?
« Reply #27 on: April 29, 2018, 10:29:27 am »
Indeed, but separation of even local declaration and implementation is by itself enough reason why I like Pascal over languages that allow inlined - as in within a implementation codeblock - variable declaration in code. That's a hell for debugging and also for team programming: you may have overlooked what another team member was doing. In Pascal you can examine the declaration block without having to search for any offending declaration with the implementation itself. And that is by design.  And IMO a very strong feature, since even properly written C(++) code will try to avoid that feature for the same reason.
If you run into the need for such a variable you should look at a local function or procedure to handle it while in scope and indeed compiler inlining will do a good job in most such cases.
« Last Edit: April 29, 2018, 10:31:59 am by Thaddy »
Ada's daddy wrote this:"Fools are my theme, let satire be my song."

Zoran

  • Hero Member
  • *****
  • Posts: 1253
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: Why Pascal?
« Reply #28 on: April 29, 2018, 04:47:11 pm »
Okay, but to be complete I should also say that, while block scope in C++ (*) is a plus for me, lacking "routine nested in routine" Pascal feature is much bigger minus for C++. So, when comparing these two features, Pascal wins.

(*)
I prefer to write "C++" here, not "C-like languages", just because I think that among C, C++, Java, C#, C++ is the first to be compared with Object Pascal (object oriented, compiles to native code).
« Last Edit: April 29, 2018, 04:54:34 pm by Zoran »

Thaddy

  • Hero Member
  • *****
  • Posts: 6898
Re: Why Pascal?
« Reply #29 on: April 30, 2018, 09:06:44 am »
It is a bit more complex than that since  Objective C is also a candidate here and - one year - older than C++. The "feature" that started this is C syntax. C++, objective C and Object Pascal can all be used in a procedural way too. They are supersets of course. To me the biggest disadvantage of C++ are its long compile times even if it leads to - not even always - very efficient code generation.
Ada's daddy wrote this:"Fools are my theme, let satire be my song."

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus