Slashdot Mirror


GNU Pascal Compiler Released For Mac OS X

MacDaffy writes "Kudos to Adriaan Van Os: He has produced a 'second prerelease' of the GNU Pascal compiler for Mac OS X. Work actively proceeds on porting the Carbon Pascal Interfaces for use with it (longtime Macintosh Pascal guru Peter N Lewis has already gotten a great start on this). Thanks to Adriaan, Peter, and Bill Catambay of Pascal Central for helping take Pascal on Macintosh into the future."

17 of 77 comments (clear)

  1. .pas pascal program by Anonymous Coward · · Score: 3, Funny



    { firstpost.pas }

    var
    s : String;

    begin
    Write('First post');
    ReadLn(s);
    WriteLn('You typed: ',s);
    WriteLn('Hit <Enter> to exit');
    ReadLn;
    end.

  2. Waiting for carbon bindings by Matthias+Wiesmann · · Score: 2, Informative
    This is really good news, a long time ago pascal was the default language of Mac OS. My first Mac OS programs were all written in pascal. Ah, the time I spent reading the Inside Macintosh books.

    I guess I'm not the only one, and there probably is a fair amount of old pascal code that is waiting to be ported to OS X. If the carbon bindings are ported, recompiling should be reasonably easy.

  3. Pascal by Daimaou · · Score: 3, Interesting

    Pascal was the first language I ever used. I have to admit that for me, Pascal's syntax was very conducive to learning the basics of programming. Having said that, after less than a year of Pascal programming I finally braved a peak at C, and I never looked at pascal again.

    I think pascal is a great language for teaching people how to program, and I also think it is perfect for Borland's Delphi product (a nice, easy to learn RAD environment to compete with Microsoft's Very Basic). However, I personally would never use Pascal on a project. If I wanted to use something like Delphi, I would use C++Builder. Of course, since this is a Mac discussion, most of this is irrelevant.

    Anyway, I am not familiar with Objective C, but if I were going to program for a Mac, and OC and Pascal were the only two choices, in spite of already knowing Pascal, I think I would rather learn Objective C.

    1. Re:Pascal by WatertonMan · · Score: 2, Interesting
      Speaking of Delphi, I've wondered why Borland doesn't offer Kylix for the Mac. Kylix is basically Delphi for Linux and offers a reasonable degree of crossplatform compatibility.

      Of course rumor is that Borland may drop JBuilder on OSX because of poor sales. So that may not bode well for Borland developing for Apple period. They do seem to be (wisely) trying to stay focused on large markets.

  4. Why??? by Draoi · · Score: 3, Funny
    I understand that there doesn't need to be a reason why something should be implemented so long as it scratches a programmer's itch, but Pascal on the Mac was dreadful as an API for developing Classic apps. Most Mac developers breathed a sigh of relief when Apple finally killed it. Even today, there's still a legacy of MacOS's Pascal origins (length-prefixed strings in APIs and file system structures, wacky structure alignment issues, etc.)

    I can remember picking up maintenance on certain Mac apps and being horrified to find them written in a mixture of Pascal, C and 68K Assembler. All compiling under MPW and linking to a fat binary (yeah, with the 68K code).

    Anyways - when I read the link, my initial reaction was 'Yeek! Pascal on the Mac again!'

    --
    Alison

    "It is a miracle that curiosity survives formal education." - Albert Einstein

    1. Re:Why??? by Draoi · · Score: 2, Insightful

      I think that's stretching things a bit. Chances are, task X has been solved in C in the interim. Doing the recompile & fixing the glitches would probably take as long as re-coding it in C ...

      --
      Alison

      "It is a miracle that curiosity survives formal education." - Albert Einstein

    2. Re:Why??? by jellomizer · · Score: 3, Insightful

      Well it really depends on what you wrote and how you written it. It may have just been a lot of math calculations and using mostly basic sections of language. Not every piece of code that people write are inteded to be sold to the public or even releaced it is just a custom tool for a custom job. There are no really interface advantages to it but they are there. There is actually a lot of time I wish I didn't loose some of my old code when I was in 6th grade, Becauce when I was younger I had more free time and came up with some interesting tools. Not I am usually burnt out at the end of the day and dont want to code anymore so if I could just easlly port over some of my code it makes my life easier.

      --
      If something is so important that you feel the need to post it on the internet... It probably isn't that important.
    3. Re:Why??? by WatertonMan · · Score: 3, Insightful
      Actually I loved Lightspeed Pascal which became Codewarrior. It was, at the time, light years ahead of any other development system, especially in its IDE.

      MPW I never was able to get into. It had an odd mixture of editor/cli which I never liked. Further it lacked a lot of the nice debugging features that Lightspeed Pascal had. This was *way* back in the 68K days, mind you. Programming was a damn site easier then. Further the initial versions of C for the Mac required lots of resources and never were as nice as Pascal initially. Further even on the PC side Turbo Pascal (which became Delphi) was king.

      Where Apple went wrong was never following Borland's lead and pushing their development system more towards RAD. That was true with C/C++. Indeed I think one of the reasons that Apple had troubles in the mid-90's was that it was so much easier to develop software on the PC than the Mac. As computers became more complex they retained the basic approach of the 80's. That's fine and even desirable for some applications. And they did have a framework for MPW and then there was PowerPlant for CodeWarrior. But neither really addressed people who weren't trying to write an application they wanted fine control over. There never was a Delphi for the Mac.

      Now we have Interface Builder and Obj-C. However I still think, as nice as those are, that Microsoft with C# and Borland with Delphi/C++ Builder have better RAD tools.

    4. Re:Why??? by MacDaffy · · Score: 2, Interesting
      Pascal on the Mac was dreadful as an API for developing Classic apps


      You must have had a lot more trouble than I did. I could put together a pretty robust Classic application with ResEdit and CodeWarrior in a couple of hours. I wrote a wireless signal strength meter a couple of years ago that still runs fine under Classic. I've also done things like generate SMB packets for server testing, build a quick-and-dirty ping app, make small educational programs, parse raw Ethernet packets, and generate calendar-based import files for FileMaker Pro. The time and headaches I saved over doing them in C were well worth it just for the string-handling alone.

      (BTW, I share your pain vis-a-vis the maintenance of the mudball that became Macintosh system programming, but that was more an outgrowth of the evolution of the platform and the programming tools than anything else. Revolutions are messy).

      Pascal is clean, straightforward and reliable. If someone reads my code, they won't wonder what I casted "void" to and where I did the casting. There's nothing I can do in C that I can't do in Pascal and it'll be easier to debug and maintain. And C++? I consider it a full-employment device designed for the John Forbes Nash wing of the programming arts.

      GNU Pascal on Mac OS X is a good thing! ;-)
  5. Archeo-computaion by goombah99 · · Score: 3, Funny

    Archeo-computologists every where will rejoice at this. I'm still holding my breath for the long awaited GNU ENIAC emulator so I can get all my old eniac programms running again. Now if I can just remember where I stored the wiring punch boards...

    --
    Some drink at the fountain of knowledge. Others just gargle.
  6. What is really wrong with it? by Anonymous Coward · · Score: 2, Insightful

    What is so wrong with Pascal, that it is not taken seriously as a language? I'm not a really a programmer, but I have written some small utilities in Delphi. It seems to work well for such things. I'm just curious as to why it is considered so bad.

    1. Re:What is really wrong with it? by jaoswald · · Score: 4, Informative

      That's a very interesting question. I'm not sure there is a very compelling answer, however.

      Some of it is simply fashion: as C grew in popularity, it simply overtook Pascal in the new APIs that were developed. Once Pascal interfaces to the Mac OS became second-class citizens, there was no reason to favor it.

      Another part of it is that Pascal was originally a teaching language, meant to indoctrinate structured programming. It deliberately tries to hide machine or OS-level reality with an idealized abstraction. It was not meant as a flexible all-purpose language like C. You couldn't write an OS kernel in Pascal very easily. One specific area in which it lacks flexibility is type conversion. For pointer or scalar (enum & integer) types, it really wants you to pick one type and stick with it. Good for enforcing discipline on software engineering students learning to design structured data types, poor for hackers who need to deal with the not-so-disciplined reality.

      Another area where it lacks is file I/O. The standard doesn't really define byte-level results of its file operations, so reading/writing files compatible with other languages/API's depends on vendor extensions, which aren't uniform.

      Similarly for structure layout. Although it isn't 100% defined, you can usually convince any C compiler on a given platform to agree with any particular arrangment of bytes in a structure. It's much harder with Pascal. This means that no matter what your OS, C code can be written mostly independent of compiler vendor, or at least with the nastiness hidden in header files.

      Pascal also has a pretty inflexible (perhaps a bit clumsy) structure for writing your own libraries (units). In C implementations, you write a bunch of routines, a header file for users to #include, and make a .o file, and you are most of the way there. I.e., any program that doesn't have "main()" defined yet is a library waiting to happen. In Pascal, it is just slightly less convenient.

      There are also a couple of omissions. I believe many implementations did not allow functions to return structure types. That's what drove me to C from Pascal many years ago. I believe arbitrary length arrays are also a bit clumsy to work with (not like C where you can have null-terminated arrays and use pointer arithmetic to navigate). Polymorphic types & pointers are clumsier in Pascal (no void* to ignore the differences when you want to.)

      In general, Pascal works fine if you are writing a single application that requires only interfaces & libraries that your compiler vendor knew about. TeX by Knuth is an example. His programs (at least of that era) are monoliths, not collections of libraries and interfaces. You need to tweak a few routines to work with a particular vendor/platform, and that's only because Knuth very consciously made it that way.

      Once you start working with libraries from multiple sources, the Pascal model begins to strain.

      The Pascal folks would say that "Extended Pascal" plus OS-specific extensions in most compilers allow you to overcome all of these. But the extensions only happened after C began spreading like a virus, helped by its exposing all the weaknesses in Pascals that lacked full extensions.

    2. Re:What is really wrong with it? by Col+Bat+Guano · · Score: 2, Insightful

      Ada is also being ported to OS X, and can be viewed as an industrialised Pascal.
      OO, multithreading, good support for low level access and interfacing to other languages.
      It's a pretty easy step to translate Pascal code to Ada (can be done automatically).

      Ada is certainly better than C for writing code; probably not as flexible as Objective-C.

  7. Great ... by shayborg · · Score: 2, Informative

    I have FORTRAN, I have Pascal, now hurry up and finish my COBOL compiler!

    Seriously, I started out programming for the Classic Mac OS in Pascal ages ago, but haven't touched it recently; with all the C, Java, etc. tools now available for OS X Pascal has been, quite correctly, left by the wayside. It feels kind of archaic to me now, and I gather I'm not alone ...

    -- shayborg

  8. Pascal *sigh* the memories by vasqzr · · Score: 3, Insightful



    Anyone NOT cut their teeth on a Tandy or IBM XT/AT, Turbo Pascal?

    What was so great about TurboPascal?

    The IDE. Pretty much the first hobbyist compiler package with an IDE. No more "exit editor, compile, get error, edit, compile, run" etc etc

    Remember using it for demos? Compiled way faster and smaller than the C compilers did at the time.

    Remember Turtle Graphics?

    BGI?

    Turbo Vision?

    Remember using it for BBS doors? FOSSIL drivers?

    Back in the early/mid-80's, when TurboPascal first came out, for $49, it rocked the world and made Borland in to a HUGE success.

  9. this is so exciting by klez23 · · Score: 2, Funny

    Now i can use all my first year computer science programs from 1992! It's been a long time since my computer said, "hello world!"

  10. Re:Make the OTHER switch by RevAaron · · Score: 4, Insightful

    ...and some of us hate C because it is the embodiment of excessive syntax, confusing idioms, and a notorious inease of use. Not all languages are easier to program at the expense of power. I can't say that I'm a huge fan of Pascal (not touched it in years), but C is pretty far down on the list of languages if I had to use only one for the rest of my life.

    C has its place, to be sure. So does Pascal. Neither have much of a place in my toolbox for what I do.

    Apple may have lost you as a programmer, and you seem to think that is a huge loss on Apple's part. What killer app did you bring to another platform that they missed out on?

    Pascal is junk. Free software forever.

    RTFA. The port is of GNU Pascal. Which is free software. It's sad to see so many oSs h4k3rz associate C so closeley with Free software that there is no room for any other languages.

    What does C do that Pascal doesn't?

    --

    Working toward a usable PDA environment in the spirit of Newton OS: Dynapad