Recent

Author Topic: Pascal and Cousins  (Read 4094 times)

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 9280
  • FPC developer.
Re: Pascal and Cousins
« Reply #15 on: February 02, 2021, 06:10:49 pm »
do you gain the benefits of reference counting on most other types in general, including your own?

Are there any base classes from which any other derived types gain the benefits of reference counting?

Ref counting is only better than GC for limited use.

PascalDragon

  • Hero Member
  • *****
  • Posts: 2981
  • Compiler Developer
Re: Pascal and Cousins
« Reply #16 on: February 03, 2021, 09:26:47 am »
Are there any base classes from which any other derived types gain the benefits of reference counting?

You need to work with reference counted interfaces (aka {$Interfaces COM} which is the default) and implement its _AddRef and _Release methods correctly. Alternatively (and preferably) you can descend from TInterfacedObject (which does exactly that), but you still need to work only with interface variables as working with the class instance will not trigger the reference counting.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4002
  • I like bugs.
Re: Pascal and Cousins
« Reply #17 on: February 05, 2021, 11:18:02 am »
vfclists, manual memory management is easy in vast majority of cases. An object is owned by another object. The owner allocates and frees the memory.
Thinking the ownership structure through may even improve your code's design.

Garbage collection does not solve all memory related problems. Java has CG but there are thick books written about Java memory management. Why so, if GC takes care of it all?
Also GC does not fix uninitialized variables.
IMO garbage collection is overrated. If you however prefer it, fine, there are plenty of choices. All new fancy languages seem to have it.
Object Pascal is a nice compromise without GC, thus less overhead, but reference counted strings which then behave almost like native types (integer and such). Good.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

MarkMLl

  • Hero Member
  • *****
  • Posts: 2539
Re: Pascal and Cousins
« Reply #18 on: February 14, 2021, 12:49:02 pm »
I went Googling yesterday evening to try to find out whether anybody had built a general-purpose OO language on top of ALGOL (other than Simula, obviously) and came across "A comparison of PASCAL and ALGOL 68" by Tanenbaum.

https://research.vu.nl/en/publications/a-comparison-of-pascal-and-algol-68

It's rather a gem, and I'm surprised it's not got wider circulation. However it appears to "read quite a lot into" J&W's definition of the language, for example it asserts that pointers can refer to items on the heap but not to items on the stack.

Perhaps the most interesting thing is that, reading between the lines, it demonstrates that much that we are used to in today's mainstream languages originated /either/ in ALGOL-68 /or/ in Pascal: the concept differed in the two languages, and posterity has selected from one or the other.

MarkMLl

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

lucamar

  • Hero Member
  • *****
  • Posts: 3887
Re: Pascal and Cousins
« Reply #19 on: February 14, 2021, 01:33:34 pm »
[...] came across "A comparison of PASCAL and ALGOL 68" by Tanenbaum.

https://research.vu.nl/en/publications/a-comparison-of-pascal-and-algol-68

It's rather a gem, and I'm surprised it's not got wider circulation.

One has always to be careful and remember that this kind of papers refer to the original J&W Pascal but yes, it's quite a gem. Thanks, Mark, I've enjoyed it a lot :)
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

MarkMLl

  • Hero Member
  • *****
  • Posts: 2539
Re: Pascal and Cousins
« Reply #20 on: March 07, 2021, 03:37:48 pm »
Here's another interesting paper I've just come across

"The design and implementation of modula for the Burroughs B1700 computer" https://openresearch-repository.anu.edu.au/handle/1885/138340

That's one of very few references I've seen to Modula as distinct from Modula-2, and it highlights a number of interesting points e.g. preemptive processes rather than coroutines and a module structure much like that proposed by Brinch Hansen.

It's also one of few things that looks at the B1700 at a low level. That was an odd system with bit-addressable memory and 1-24 bit operands https://www.vintagecomputer.net/burroughs/B1700/Burroughs_B1700_Front-panel.jpg The hole in that photo should have a cassette (not cartridge) drive in it which was used as an instruction source during boot.

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

 

TinyPortal © 2005-2018