Recent

Author Topic: Pascal origin, where does it come from  (Read 20593 times)

valdir.marcos

  • Hero Member
  • *****
  • Posts: 1106
Re: Pascal origin, where does it come from
« Reply #45 on: September 29, 2020, 01:02:22 pm »
That leads us to three questions:
1. Why Niklaus Wirth moved on from Pascal to Modula, and then to Oberon?
2. Is there any current worth mentioning professional software built with Modula or Oberon?
3. Is Modula or Oberon any better than modern Pascal?
My understanding:

1) Separate compilation (in particular separate precompiled definition modules), remove "magic" required for things like WriteLn() from the language, coroutines, and better-defined type checking. Strings implemented as zero-based arrays of char might or might not have been an advance, bitsets were an advance but ordering was platform-specific without adequate infrastructure.

2) Not that I know of.

3) Fixes dangling-else. Arguably provides a more robust base language on which extensions could be built, but ideally this would require an extensible language definition accessible to (senior) application programmers.

MarkMLl

Quote
1) Separate compilation (in particular separate precompiled definition modules),
Ok.

Quote
remove "magic" required for things like WriteLn() from the language,
Was that so bad?

Quote
coroutines,
What do you mean?

Quote
and better-defined type checking.
Ok.

Quote
Strings implemented as zero-based arrays of char might or might not have been an advance,
Knowing the number of characters in a string up to 256 characters stored in [ 0] was a bad idea?

Quote
bitsets were an advance
What do you mean?

Quote
but ordering was platform-specific without adequate infrastructure.
What do you mean?

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: Pascal origin, where does it come from
« Reply #46 on: September 29, 2020, 01:15:07 pm »
Quote
remove "magic" required for things like WriteLn() from the language,
Was that so bad?

Yes, since the language was not extensible. In particular in the case of Writeln() etc. Pascal (as per J&W) has no provision for "variadic" parameter lists or for open (dynamically-sized) arrays.

Quote
Quote
coroutines,
What do you mean?

See https://en.wikipedia.org/wiki/Coroutine

Quote
Quote
bitsets were an advance
What do you mean?

Quote
but ordering was platform-specific without adequate infrastructure.
What do you mean?

A bitset was defined as allowing access to the individual bits in a machine word, but the definition omitted any statement as to whether bit zero was LSB or MSB... and I've seen both assumptions made, even on the same target CPU.

Don't get me wrong: Modula-2 was useful, and I've used it to write a microkernel (portable between Z80, 8086 on DOS, and 80286 bare-metal protected mode).

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

valdir.marcos

  • Hero Member
  • *****
  • Posts: 1106
Re: Pascal origin, where does it come from
« Reply #47 on: September 29, 2020, 01:46:43 pm »
Quote
remove "magic" required for things like WriteLn() from the language,
Was that so bad?
Yes, since the language was not extensible. In particular in the case of Writeln() etc.
Pascal (as per J&W) has no provision for "variadic" parameter lists or for open (dynamically-sized) arrays.
Who is J&W?

extensible language
https://en.wikipedia.org/wiki/Extensible_programming
http://www.cas.mcmaster.ca/sqrl/papers/SQRLreport47.pdf

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: Pascal origin, where does it come from
« Reply #48 on: September 29, 2020, 01:55:05 pm »
Quote
Strings implemented as zero-based arrays of char might or might not have been an advance,
Knowing the number of characters in a string up to 256 characters stored in [ 0] was a bad idea?

I don't know how the original string definition of Wirth was, but at least in ISO Pascal it's as follows (6.4.3.2 Array-types):

Quote
Any type designated packed and denoted by an array-type having as its index-type a denotation of a subrange-type specifying a smallest value of 1 and a largest value of greater than 1, and having as its component-type a denotation of the char-type, shall be designated a string-type.

Thus a ShortString as we know it from TP did not exist.


hansotten

  • Jr. Member
  • **
  • Posts: 88
Re: Pascal origin, where does it come from
« Reply #50 on: September 29, 2020, 01:57:38 pm »
Quote
Who is J&W?
Kathleen Jensen and Niklaus Wirth, mostly this is a reference to the Pascal User Manual and Report book.

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: Pascal origin, where does it come from
« Reply #51 on: September 29, 2020, 02:52:06 pm »
Who is J&W?

The adoption of Pascal owes as much to Kathleen Jensen's clear exposition as to Wirth's design.

Quote
extensible language
https://en.wikipedia.org/wiki/Extensible_programming

A fairly good review. I'd add however that during the '60s, i.e. the first period discussed in that article, binary linkage hadn't really caught on: not only was it far more common to either have to submit an entire program as a single card deck or possibly augment the source with files included from tape or disc, but there was really no concept of a separate system library which implemented e.g. the I/O facilities which were nominally part of the language.

In other words, in the 1960s if you wanted to change the behaviour of something like WriteLn() then it was considered to be extension of the language: there was no real way to say "link in a non-standard RTL so that my program can access a novel peripheral device".

Modula-2 wasn't the first language/implementation to support binary linkage. It was, however, arguably the first to (a) provide robust type-checked separate compilation and (b) by having distinct definition and implementation modules allow the possibility of applying access restrictions to ensure that junior staff couldn't override specifications provided by their betters.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: Pascal origin, where does it come from
« Reply #52 on: September 29, 2020, 03:53:59 pm »
remove "magic" required for things like WriteLn()

Minimalism in general. Maybe also portability.

Quote
Strings implemented as zero-based arrays of char might or might not have been an advance,

Well, he would have been comparing from seventies Pascal, not eighties UCSD/TP strings.

On one hand the open array ability improved writing general string routines compared to seventies pascal, on the other hand in retrospect keeping it mostly statically allocated was maybe a missed opportunity, and something that wouldn't survive the eighties. Even for systems programming.

Quote
bitsets were an advance but ordering was platform-specific without adequate infrastructure.

Maybe for embedded programming, flag testing etc. But imho bitpacking of records is more important for that.

Quote
3) Fixes dangling-else. Arguably provides a more robust base language on which extensions could be built, but ideally this would require an extensible language definition accessible to (senior) application programmers.

Some of the language things of Modula2 were ok, compared with nineties Pascal. But it didn't even have the practical extension and implementation that Pascal had. The Modula2 world was so small.

I do know that some medical vendors used Modula2 a lot in the nineties for critical systems, but most of that has disappeared (some reached out to me in the 2005-2010 timeframe to assess what they had, which was TS 1.17 dos code, so not much)

Oberon was always more experimental. I never saw professional Oberon use myself.

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: Pascal origin, where does it come from
« Reply #53 on: October 15, 2020, 09:32:01 am »
I've just started reading a paper by Knuth called "Structured Programming with goto Statements". https://www.cs.sjsu.edu/~mak/CS185C/KnuthStructuredProgrammingGoTo.pdf

I suggest that it might be of interest to others, since it pulls together examples and opinions from a number of luminaries of the 60s and early 70s, including even Val Schorre whose Meta-2 I've mentioned in the past.

One of Kunth's observations is that

"...people are now beginning to renounce every feature of programming that can be considered guilty by virtue of its association with difficulties. Not only goto statements are being questioned; we also hear complaints about floating-point calculations, global variables, semaphores, pointer variables, and even assignment statements. Soon we might be restricted to only a dozen or so programs that are sufficiently simple to be allowable; then we will be almost certain that these programs cannot lead us into any trouble, but of course we won't be able to solve many problems."

But particularly telling is this from Dijkstra himself:

"Please don't fall into the trap of believing that I am terribly dogmatical about [the goto statement]. I have the uncomfortable feeling that others are making a religion out of it, as if the conceptual problems of programming could be solved by a single trick, by a simple form of coding discipline!"

And of course the ACM editor who caused all the trouble by giving Dijkstra's original paper a snappy title was Niklaus Wirth.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: Pascal origin, where does it come from
« Reply #54 on: October 15, 2020, 10:06:08 am »
"Please don't fall into the trap of believing that I am terribly dogmatical about [the goto statement]. I have the uncomfortable feeling that others are making a religion out of it, as if the conceptual problems of programming could be solved by a single trick, by a simple form of coding discipline!"

I liked a professor that said (on the question of some l33t person about the usage of assembler in an TP assignment) that you could use anything, but anything not in the handout required three page essay to explain why you really needed that feature.

I still think that is a nice litmus test, I also apply it to gotos. I have 2 gotos in my work (Delphi) codebase :-)

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: Pascal origin, where does it come from
« Reply #55 on: October 15, 2020, 10:16:50 am »
:-) But have you ever tried to read any of Wirth's early compilers, even the ones written in ALGOL?

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

mischi

  • Full Member
  • ***
  • Posts: 170
Re: Pascal origin, where does it come from
« Reply #56 on: October 15, 2020, 10:44:54 am »
My 2 cents: I converted an old style Fortran program with its usual amount old fashioned constructs like (arithmetic) GOTOs and IFs. Taking into account the time of its creation, it was fairly nice code. At least compared to other hacks, i have seen from those times. The initial motivation was simply style, aestethics, maybe readability for young programmers.

To my surprise the program gained execution speed already with moderate optimisation levels. I assume that the more modern constructs have a more clear path of flow and are easier to optimise than the old style spaghetti-type of code.

MiSchi.

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Pascal origin, where does it come from
« Reply #57 on: October 15, 2020, 11:26:35 am »

I don't know how the original string definition of Wirth was, but at least in ISO Pascal it's as follows (6.4.3.2 Array-types):

Hi!

There was no string definition in Wirths Pascal.   
From his point of view you could it build yourself with an array of char.

The first Pascal string definition occured in UCSD Pascal: The well know "Pascal (short) strings".

Later it was used in Turbo Pascal.

Winni

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: Pascal origin, where does it come from
« Reply #58 on: October 15, 2020, 01:45:51 pm »
There was no string definition in Wirths Pascal.   
From his point of view you could it build yourself with an array of char.

The first Pascal string definition occured in UCSD Pascal: The well know "Pascal (short) strings".

J&W ed. 4 linked to earlier certainly discusses strings, both in the literal form and one defined as  packed array[1..n] of char

I don't know if that was in earlier editions (and am not checking since I'm going out soon), and I note the careful definition to avoid element zero which might have been because by then UCSD etc. had done its own thing.

Modula-2 of course had no special string type, but instead used (open?) arrays with zero origin.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: Pascal origin, where does it come from
« Reply #59 on: October 15, 2020, 02:04:45 pm »
Modula-2 of course had no special string type, but instead used (open?) arrays with zero origin.

Static arrays that could be passed to open array procedures.   Partially zero terminated (if the string completely filled the allocation size, then it was not zero terminated.

 

TinyPortal © 2005-2018