Fairly large chunks of classic Macintosh system software were written in Pascal, IIRC.

Yeah that doesn't mean that it's a good language. Frankly it's antiquated and it sucks, and every time I've tried to use it I just can't THINK straight!!!

I know the feeling... when using C. That has nothing to do with the language but how hardwired we can get to our language of choice. Try thinking in another language like German or french if you rarely speak it. Same problem.

Pascal isn't antiquated in any way. Altho I wouldn't suggest using TP7 for a new project, just as I wouldn't suggest Visual C 1.0.

The free pascal compiler is up to date, compiles itself and is capable of everything C can do.

onlyonemac wrote:

there's no need to fuss with the incoherencies of a language like Pascal that was designed for a previous era.

Which incoherencies? When trying to write pascal while thinking in C?

onlyonemac wrote:

And once you've written everything in Pascal, you'll have to keep it that way or at least make a lot of changes to any code that you use that is written in other languages, as the calling style is significantly different from the ubiquitous C style.

Have you ever actually written anything in Pascal? It supports all calling conventions on a per procedure/function basis including cdecl, stdcall, fastcall etc.

Need an example on how to use them?Procedure HelloWorld(); stdcall;Procedure HelloWorld(); cdecl;

You can mix Pascal just fine with C, Go, Assembler and lots more. Fits like a glove, no problems what so ever.

_________________"Always code as if the guy who ends up maintaining it will be a violent psychopath who knows where you live." - John F. Woods

Just wanted to add, Delphi-style "object oriented" pascal is braindead, especially past version 7.If that's the "Pascal" you were thinking about, then i totally agree.But Delphi to Pascal is what Hitler is to Charlie Chaplin's mustache style - a bad execution that gave a good thing a bad name.Please keep that in mind.

But that topic wasn't the place to do it so lets "fight" about it here.

Be warned... I don't lose fights!

Nutterts wrote:

Pascal isn't antiquated in any way.

Name one current, mainstream project that uses Pascal.

Nutterts wrote:

Which incoherencies? When trying to write pascal while thinking in C?

No, incoherencies in language structure and syntax. As in, in one context a particular thing should be written a particular way whereas in another context it should be written another way, whereas C as a unified structure and syntax - it doesn't matter what the context of a line or block of code is, it's still written the same way.

Nutterts wrote:

Have you ever actually written anything in Pascal? It supports all calling conventions on a per procedure/function basis including cdecl, stdcall, fastcall etc.

I have written stuff in Pascal before. And I mean as in, without bothering to add extra bits of code to every function just to make it compatible with the rest of the world. In other words, pure Pascal is not compatible in the manner that you describe - in order to ensure compatibility with the rest of the world, you have to add extra clutter to your code.

_________________When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.

Auwtch... yeah, I probably was so traumatized from using Delphi 8 back then that I forgot how horrible it got after Delphi 7. If people got traumatized into hating pascal because of those implementations then I totally get it! It almost made me abandon the language myself.

_________________"Always code as if the guy who ends up maintaining it will be a violent psychopath who knows where you live." - John F. Woods

Just by the way, I have not used Delphi if that's what you're thinking. I'm talking about Pascal, as in the traditional Pascal that hasn't been updated for at least 15 years. And the various "modern" Pascals which are so full of bloated extensions that they might as well not exist.

_________________When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.

No, incoherencies in language structure and syntax. As in, in one context a particular thing should be written a particular way whereas in another context it should be written another way

For example (including why is it bad)?

onlyonemac wrote:

without bothering to add extra bits of code to every function just to make it compatible with the rest of the world.

Hm?A. What sort of code are you talking about? At worst you had to add stdcall or cdecl to the function declaration, AFAIK.B. How does that matter for OS dev? Your OS, your rules (going back to the original *shudder*).

onlyonemac wrote:

Just by the way, I have not used Delphi if that's what you're thinking. I'm talking about Pascal, as in the traditional Pascal that hasn't been updated for at least 15 years. And the various "modern" Pascals which are so full of bloated extensions that they might as well not exist.

Ah. Classic "learned in school" pascal is also not a real programming language.You need at least a few modern features to make it a useful high-level language.

Hm.In my case it's a get-the-best-from-everywhere subset of a language, so we are quite likely talking about essentially different languages.

Good luck trying to satisfy me that something designed for Windows 3.1 and which has a webpage looking like it's from the 90s is really "current". Besides, that's just one against an almost infinite number of projects written in C, or another modern language such as Java. So you're going to have a hard time convincing anybody that Pascal is actually used in the field these days.

Artlav wrote:

onlyonemac wrote:

No, incoherencies in language structure and syntax. As in, in one context a particular thing should be written a particular way whereas in another context it should be written another way

For example (including why is it bad)?

I can't remember anything off the top of my head but I remember a good few examples in the Pascal programming book that I read, which I would post here if only my sight was still good enough for me to read said book.

Artlav wrote:

onlyonemac wrote:

without bothering to add extra bits of code to every function just to make it compatible with the rest of the world.

Hm?A. What sort of code are you talking about? At worst you had to add stdcall or cdecl to the function declaration, AFAIK.B. How does that matter for OS dev? Your OS, your rules (going back to the original *shudder*).

A. So? Having to add either "stdcall" or "cdecl" after EVERY function definition is a real pain in the @$$ and wouldn't be necessary if you used a more standard language, instead of trying to bend a non-conforming antiquated language to fit the modern world.B. Your OS, your rules, but trying to do any low-level work in a language such as Pascal which has such a ridiculously high-level syntax that you can't really write decent system code in it (note that I said "DECENT system code") seems like a poor choice. And it is a major oversight in two ways: firstly if you later decide to write other parts of your OS in C, your existing codebase will be incompatible with it (unless you add "stdcall" or "cdecl" to every exported function, or "pascal" in front of every C function to specify Pascal calling style, neither of which is a very good idea) and secondly it will be impossible to port any standard libraries to your operating system, including such things as OpenGL, Cairo, etc. unless you add the correct calling directives to every function (see first part).

Artlav wrote:

You need at least a few modern features to make it a useful high-level language.

Exactly my point. And to add those "modern features" to an outdated language is going to require a significant amount of syntactical bloat which is what we get with e.g. specifying calling styles.

_________________When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.

I'm not arguing that pascal is more popular or used more often. I'm just saying it can do anything that C can and that the language is easier to read.

onlyonemac wrote:

Nutterts wrote:

Which incoherencies? When trying to write pascal while thinking in C?

No, incoherencies in language structure and syntax. As in, in one context a particular thing should be written a particular way whereas in another context it should be written another way, whereas C as a unified structure and syntax - it doesn't matter what the context of a line or block of code is, it's still written the same way.

Can you give me an example because I clearly never noticed that before.

onlyonemac wrote:

Nutterts wrote:

Have you ever actually written anything in Pascal? It supports all calling conventions on a per procedure/function basis including cdecl, stdcall, fastcall etc.

I have written stuff in Pascal before. And I mean as in, without bothering to add extra bits of code to every function just to make it compatible with the rest of the world. In other words, pure Pascal is not compatible in the manner that you describe - in order to ensure compatibility with the rest of the world, you have to add extra clutter to your code.

Pure pascal is having the ability to select the calling convention. It's been so for as long as I can remember, even in de 80's. For unexported functions I leave it to the compiler to select the most efficient one. Not selecting the desired calling convention is just bad pascal programming when it comes to exported functions.

Do I really have to mention 'void' btw? There's enough clutter and unneeded stuff in both languages. Pascal imho still remains the most readable of the two when projects get big.

Ok, you can do nice things now like operator overloading and other modern language features. C has grown up in much the same way. There probably was a time when C could do something that you just couldn't do in Pascal. But I can't imagine anything today were that's still the case.

_________________"Always code as if the guy who ends up maintaining it will be a violent psychopath who knows where you live." - John F. Woods

Good luck trying to satisfy me that something designed for Windows 3.1 and which has a webpage looking like it's from the 90s is really "current".

A. You asked for at least one.B. "New (August 26, 2015): Total Commander 8.52 final (32+64 bit) for Windows released" It's as modern as today, pretty much. That's what matters, not what it's oldest version can do or the site looks like.

onlyonemac wrote:

A. So? Having to add either "stdcall" or "cdecl" after EVERY function definition is a real pain in the @$$ and wouldn't be necessary if you used a more standard language, instead of trying to bend a non-conforming antiquated language to fit the modern world.B. Your OS, your rules, but trying to do any low-level work in a language such as Pascal which has such a ridiculously high-level syntax that you can't really write decent system code in it

A. Far from every program is a library that exports a ton of functions. Sure, there is a bit of discomfort for that, but you won't see it 99% of the time, no?

B. Having done it, i fail to see the problems. Can you elaborate?

onlyonemac wrote:

secondly it will be impossible to port any standard libraries to your operating system

It certainly would be *tricky*, i agree.

onlyonemac wrote:

Exactly my point. And to add those "modern features" to an outdated language is going to require a significant amount of syntactical bloat which is what we get with e.g. specifying calling styles.

Every language is outdated by that logic.It's not like there is "The Pascal" and "Bloat" with nothing in between them.

I'm really more on Pascal's side and would love to defend it (more precisely, the ObjFPC dialect) if there were any substantial arguments. The only thing I can see so far is the "cdecl;" thing. I just wonder why having to declare things extern "C" in C++ doesn't make people react in the same way when they see someone doing a C++ kernel.

Anyway, while we're waiting for arguments, I'll tell you two points why I think OSDev with FPC sucks. The first is simply syntactic sugar of various kinds that I'm used to from C: Macros are much less useful because units (which replace headers) can't make them available, arrays need to be declared with their size instead of deriving it from the initialiser list, initialisation syntax in general isn't as nice as C's designated initialisers. Small things like that, but they are annoying.

The other one is that the compiler isn't really meant for making changes to or even writing your own system unit. If a compilerproc is missing or has the wrong interface, you usually get a fatal internal error with a number and no useful message. Next thing is grepping the compiler source for the number and checking what was really missing. That's not quite how I'd like the error handling to be.

_________________Developer of tyndur - community OS of Lowlevel (German)

I was actually going to say in the post where I originally asked that question that a Pascal compiler is not a valid answer, but I thought that that was obvious.

Artlav wrote:

B. "New (August 26, 2015): Total Commander 8.52 final (32+64 bit) for Windows released" It's as modern as today, pretty much. That's what matters, not what it's oldest version can do or the site looks like.

So it doesn't matter when the last release was, it's still an old program and it's most likely only written in Pascal today because that's how it's always been, and I bet the developer regrets that decision with all the other elegant C projects coming out these days.

Nutterts wrote:

the language is easier to read.

That is rather subjective. At least I've been keeping my arguments (mostly) objective.

Nutterts wrote:

Do I really have to mention 'void' btw? There's enough clutter and unneeded stuff in both languages.

At least C is consistent by making "functions" (which return a value) and "procedures" (which do not return a value) more or less the same thing, unlike Pascal which uses separate (and rather long) keywords to distinguish them (a good example of the kinds of inconsistencies which I am referring to) and which thus causes numerous issues such as requiring the programmer to change the keyword when adding a return value for a function and not permitting the programmer to discard the return value as is possible in C by simply not specifying a return location. So whereas in C we can have a list of e.g. file-handling functions, some of which return a file pointer or an error code and some of which return nothing, and we can call them all functions or call them all procedures because the terms are basically synonymous, in Pascal we now have to call some of them procedures and some of them functions (and they are also represented as such in the code) based on whether or not they return a value which is really irrelevant to their logical grouping in either the source code or the documentation.

Artlav wrote:

B. Having done it, i fail to see the problems. Can you elaborate?

I guess it's mainly just because I find Pascal incredibly unreadable and illogical in its structure, but if one analyses it I guess there's not really anything about the language itself that makes such a task difficult, just that it requires a fair deal of experience with the language and a significant mental detachment from C - neither of which are really bragging points these days.

_________________When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.

Totally agree. I miss them quite often, and my own compiler is not up to speed yet...

Kevin wrote:

arrays need to be declared with their size instead of deriving it from the initialiser list

+1

Kevin wrote:

The other one is that the compiler isn't really meant for making changes to or even writing your own system unit. If a compilerproc is missing or has the wrong interface, you usually get a fatal internal error with a number and no useful message. Next thing is grepping the compiler source for the number and checking what was really missing. That's not quite how I'd like the error handling to be.

Hm? Never had that problem.Won't it just fail to compile with "fpc_so_and_so not found" error?

The only thing I can see so far is the "cdecl;" thing. I just wonder why having to declare things extern "C" in C++ doesn't make people react in the same way when they see someone doing a C++ kernel.

The cdecl thing is imho just a childish way to point out that C won the race back then. Borland screwed it up. The winner became the standard. If pascal had become the standard they'd be specifying pascal as the convention in C all over the place. Just like stdcall for windows.

Your points are way more valid then the cdecl thing. Those things aren't impossible but it is pretty annoying. Chicken & egg thing I guess. There isn't a lot of interest to write a kernel in pascal so the tools are lacking. But Artlav is right that FPC atleast fails with a clear error message of whats missing. At least for me but it's only been about simple type declarations in system.pas up until now.

_________________"Always code as if the guy who ends up maintaining it will be a violent psychopath who knows where you live." - John F. Woods

I guess it's mainly just because I find Pascal incredibly unreadable and illogical in its structure

I guess that's the core problem here.People have different perceptions, and so different tools that fit them better.

Unreadable code is a very subjective thing.I.e. i'm a very visual person, and see the code as a picture. That produces a coding style that is shocking to many other people.I also prefer disambiguation over power, and so gravitate to languages a little more high-level than C.

Remove that, and the choice of language becomes a null question - whatever is used by everyone, that is C/C++.

I find Pascal incredibly unreadable and illogical in its structure, but if one analyses it I guess there's not really anything about the language itself that makes such a task difficult, just that it requires a fair deal of experience with the language and a significant mental detachment from C - neither of which are really bragging points these days.

Exactly the point I made from the very beginning. I grew up with it. I tried C++ before I tried C and that was a mistake. Ignored C for 10 years because of a misunderstanding. Sure I regret it. But only because Borland messed up. It all didn't matter back then. I also didn't continue in it and make it my line of work. If I continued as a programmer things might have been different.

It takes a mental effort for me to switch to C, it's like crypto code to me if I haven't used it at least once a month.

_________________"Always code as if the guy who ends up maintaining it will be a violent psychopath who knows where you live." - John F. Woods

Who is online

Users browsing this forum: Google [Bot] and 2 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum