Recent

Author Topic: Free Pascal and others...  (Read 13930 times)

dracon

  • New Member
  • *
  • Posts: 18
Free Pascal and others...
« on: May 11, 2017, 09:52:57 am »
Hello to all.

I am new to the Wirthian family of programming languages. So, I would like to ask a few questions.

1) is it true that Pascal has no modules, no type safety for dynamic records, no garbage collection?
2) is Modula-2 dead? If not, why it is not more popular, since (in theory) is more powerful than Pascal?
3) is it true that Component Pascal is the most active dialect of Oberon(s) ?
4) is it true that Oberon-07/11 is mainly for embedded systems?
and
5) what is, in gross terms, the relation --applications, features and generality wise-- amongst FreePascal, Modula-2, Component Pascal ?

I would like to thank, in advance, anyone which is going to contribute to this thread.

Blestan

  • Sr. Member
  • ****
  • Posts: 461
Re: Free Pascal and others...
« Reply #1 on: May 11, 2017, 10:06:14 am »
HI!
this is forum is not some kind of sect or cult of the followers of Niklaus Wirth :)))
this is a forum about lazarus - a ide build with fpc
we discuss real problems of real programing for real applications build with fpc/lazarus .
so for you questions about oberon/modu;a etc please  refer to theire respctive forum.
so  some answers to to some of your questions:
i do not know what module is??? object, class, interface, component, unit?
about the safety of fpc please not that it can be safe as the programer know or wish to make it safe...
several garbage collection methods exists but you have to choose the best for approach your application

regards,
Tabakov
« Last Edit: May 11, 2017, 10:09:01 am by Blestan »
Speak postscript or die!
Translate to pdf and live!

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Free Pascal and others...
« Reply #2 on: May 11, 2017, 10:41:14 am »
1) Object Pascal as in FPC and Delphi (not Wirth's original Pascal) has modules, known as units.
I'm not sure what you mean by "type safety for dynamic records", but for instance you can rely on the compiler letting you add only TMyRecord elements to a dynamic array in constructs like
Code: Pascal  [Select][+][-]
  1. type
  2.   TMyRecord = record ... end;
  3.  
  4.   TMyRecordArray = array of TMyRecord;
There are not (yet) smart pointers in Object Pascal.
The closest Object Pascal comes to garbage collection is compiler-managed disposal of certain types such as strings, dynamic arrays and COM interfaces.
As Blestan points out 2), 3), 4), 5) belong in another forum.

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Free Pascal and others...
« Reply #3 on: May 11, 2017, 11:41:45 am »
is it true that Pascal has no modules, no type safety for dynamic records, no garbage collection?

Module is a term in programming, which has several meanings and as explained on the wiki page on the link below, Pascal is one of the language that formally supports the module concept. Read the source here:
https://en.wikipedia.org/wiki/Modular_programming

The default Lazarus and FPC installation do not have garbage collection. But according the link below, it is possible and some attempts have been made:
http://wiki.freepascal.org/garbage_collection

is Modula-2 dead? If not, why it is not more popular, since (in theory) is more
Lots of reasons. In theory it is better but programmers do not choose a language simply because it is better, lots of things need to be considered. Pascal still survives because Turbo/Borland Pascal and Delphi gave it some boost, and now Lazarus/FPC keeping it alive. You can read more here:
https://www.quora.com/Why-didnt-Modula-2-succeed

Thaddy

  • Hero Member
  • *****
  • Posts: 14205
  • Probably until I exterminate Putin.
Re: Free Pascal and others...
« Reply #4 on: May 11, 2017, 12:54:02 pm »
The Boehm garbage collector has been added to trunk recently as a replacement memory manager.
A similar one has been available for more than 7 years (by me).

packages/libgc
« Last Edit: May 11, 2017, 01:27:16 pm by Thaddy »
Specialize a type, not a var.

dracon

  • New Member
  • *
  • Posts: 18
Re: Free Pascal and others...
« Reply #5 on: May 11, 2017, 02:20:59 pm »
Is not true that GC is something "bad" for a systems programming language?

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Free Pascal and others...
« Reply #6 on: May 11, 2017, 02:34:36 pm »
Garbage collection has both advantages and disadvantages. One of the disadvantage is performance impact, and that is the reason for Apple not adopting garbage collection in IOS despite being the most desired feature.

Source:
https://en.wikipedia.org/wiki/Garbage_collection_%28computer_science%29

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: Free Pascal and others...
« Reply #7 on: May 11, 2017, 03:05:35 pm »
Is not true that GC is something "bad" for a systems programming language?

Depends. It can be a benefit too, since systems are almost per definition long running, so minor memleaks could accumulate over time.

But yes, GC eats time. If that matters however is a different question.

I don't use GC myself at the moment, but I have done Java and .NET in the past, and got by (though I always had a feeling what the big deal was)

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: Free Pascal and others...
« Reply #8 on: May 11, 2017, 03:17:35 pm »
1) is it true that Pascal has no modules, no type safety for dynamic records, no garbage collection?

This all depends on dialect.  Classic Pascal afaik had more safety for dynamic records than Free Pascal/delphi, in the sense that if you accessed a field that wasn't in the selected form of the dynamic record, it would generate a runtime error.

Classic Pascal has no units/modules, most surviving pascal do in one form or the other. Free Pascal/Delphi modules are a bit more limited than Modula2 modules though.

Quote
2) is Modula-2 dead? If not, why it is not more popular, since (in theory) is more powerful than Pascal?

There are some compilers in maintenance mode afaik, and GNU M2 is somewhat developed still. I still monitor comp.lang.modula2, but the flow there is extremely low.

Declaring it dead is a political statement, but it is several orders of magnitudes less active than just Free Pascal, let alone other major Pascal environments like Delphi.

Quote
3) is it true that Component Pascal is the most active dialect of Oberon(s) ?

CP is related to Oberon. It was afaik one of the first non microsoft .NET implementations. (probably because it had a java version before?). How active it is I don't know.

Quote
4) is it true that Oberon-07/11 is mainly for embedded systems?

No idea, I never considered Oberon very practical.

Quote
5) what is, in gross terms, the relation --applications, features and generality wise-- amongst FreePascal, Modula-2, Component Pascal ?

Free Pascal inherited some form of module system mostly directly (but not the same) from M2, and then there is Niklaus Wirth.  Modula2's parsing
 is typically also based on the same principles (LL, recursive descent) as Pascal.

There are some superficial syntax similarities, but that is not unique (e.g. C has FOR and WHILE too)

That's about all I can think. Very little practical, nearly everything historical. No real relation to Component Pascal at all I guess.


dracon

  • New Member
  • *
  • Posts: 18
Re: Free Pascal and others...
« Reply #9 on: May 11, 2017, 03:50:04 pm »
Dear Marcov

thank you very much for your kind contribution to the thread, especially since my questions "should not" be stated here.

The reason I posed this question is because I would like to have a clear picture of the Wirthian family before I decide which member I will be dealing with.

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Free Pascal and others...
« Reply #10 on: May 11, 2017, 04:41:28 pm »
It is good to do some researches before you put efforts on the language or software. Any language or tool can still exist because it offers some advantages than the others. But we can't simply say which one is better. It depends on who uses it and what you use it for.

If you a hobbyist or freelance, you can pick any language/tool that you feel convenient. But if you're going to look for jobs or to work in a team, you better choose the software that most people are using.

If you're planning to write computer games, you options will be different than if you're planning to write office-use applications.

You also need to consider the available documentations, tutorials and communities. You may visit and say hello on their forum and see if they're nice or not.

You should also download the software and try to create a 'hello world' program to see if its coding style suits you or not.

Some programmers use not only 1 language. For example if he gets a web project, he will use PHP but on his leisure time he writes games using C++.

Have fun.
« Last Edit: May 11, 2017, 04:44:53 pm by Handoko »

dracon

  • New Member
  • *
  • Posts: 18
Re: Free Pascal and others...
« Reply #11 on: May 11, 2017, 05:17:18 pm »
Thanks for your answer. I agree with you.

I would consider myself a hobbyist and I am somehow overwhelmed by the plethora of programming languages, so I am trying to find criteria in order to classify them -and thus finding the right one. 

BobS

  • Full Member
  • ***
  • Posts: 153
Re: Free Pascal and others...
« Reply #12 on: May 12, 2017, 03:54:18 am »
Just on the garbage collection.  Kerbal Space Program was written in C# and garbage collection has been plaguing it for a long time, they did go to a considerable effort to reduce it in recent versions though, but it certainly can be a problem (but so can memory leaks, but the worst seems to be having both :) ).

I remember Borland's Modula 2, I liked it a lot but OOP Pascal came out and that was that (as I recall anyway).

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Free Pascal and others...
« Reply #13 on: May 12, 2017, 06:32:46 am »
I've just checked KSP's forum, it seems garbage collection really causing headache for them.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: Free Pascal and others...
« Reply #14 on: May 12, 2017, 09:31:41 am »
I remember Borland's Modula 2, I liked it a lot but OOP Pascal came out and that was that (as I recall anyway).

Turbo M2 later became TopSpeed Modula2, which I used till 1997-98 when I switched to FPC.  The strong points were the better block-structure of the language, opague pointers and more options for module import. (to import specific identifiers unqualified etc) I also liked the textwindowing module (which was somewhere inbetween Crt and Turbo Vision).  Also the compiler itself had some nice features not related to M2 (like custom calling conventions, better memory model support )

The bad was not having a real string type (IMHO string code was unnecessary laborious), stdio was a bit ackward having to write long sequences of IO.WrStr, IO.WrCard etc without format or writeln() options. the pedantic case sensitivity, few libraries and a (too) small community. Add to that the Ts M2 line had a lingering existence under Clarion (not only payware, but hard to actually buy), no 32-bit options etc, I started looking for something else.

32-bit being the main motivator, since increasing amounts of work went in my old app working around memory limitations. (64k per structure, EMS/XMS etc).  Commercial 32-bit M2, already not a primary choice due to student finances and no sitelicenses, had no real non dos/windows options (and I wanted Linux/BSD in due time), so I ended up with FPC.

The lessons I learned from the M2 period were that language purity is overrated, specially when taken to extremes, and not having a(ny) community, and having to do everything by yourself is tiring.

 

TinyPortal © 2005-2018