TweetFollow Us on Twitter

Dec 96 Factory Floor
Volume Number:12
Issue Number:12
Column Tag:From The Factory Floor

Marcel Achim, Pascal Reanimator

By Dave Mark, ©1996 by Metrowerks, Inc., all rights reserved.

This month’s Factory Floor interview is with Marcel Achim, the heart and soul of Metrowerks Pascal efforts. As Neil never tires of reminding me, Pascal is alive and well and, in one publisher’s opinion, still a wonderful language.

Dave: How did you hook up with Metrowerks?

Marcel: I was recruited on the university campus by the then VP of Research who was teaching there. I became involved in an underway project, the development of a Modula-2 compiler running on various UNIX boxes built on MIPS chips. That was my introduction to the fascinating world of compilation. I started by writing library code and translating interfaces from C to Modula-2, then I moved on to porting the compiler to the different vendor boxes, figuring out their idiosyncrasies.

Dave: Were you doing this work in Pascal? If not, when did you bring Pascal and Metrowerks together?

Marcel: The MIPS compilers used a frontend/backend architecture with the backend being proprietary which caused some problems. That led to our need to develop a compiler technology where we could hold rights both on the frontend and backend. At the same time we started another project on the Macintosh to provide a Pascal compiler along with tutorial and teaching material for Macmillan. That compiler was built around the Modula-2 package available then. So the new technology was meant to provide a solution for multiple frontends and multiple backends, and was supposed to be the replacement for these versions of Pascal and Modula-2. The chosen architecture was a derivative from the Oberon architecture developed in Zurich by Nicklaus Wirth’s team and was first targeted to the SPARC platform. I then implemented Pascal and Modula-2 on SPARC using that architecture. We then stopped the development of UNIX compilers and I inherited the Macintosh compilers where I unified the Pascal and Modula-2 code generators. Around this time it was decided that we needed a C compiler, the PowerPC was in the air and we received in the mail a terrific demo from Andreas. [To hear more about Andreas’s story, check back a few issues for the interview with Andreas Hommel.]

Dave: How did the Pascal compiler make the leap to CodeWarrior?

Marcel: At this point, we had a 68K C compiler with optimizations, a split frontend/backend design. Pascal is very strong in the developer community (still today FileMaker Pro is mostly written in Pascal and is built with CodeWarrior). CodeWarrior alone would only be Metrowerks C and wouldn’t provide the broader industrial completeness and strength that we wanted to provide. So we dropped the architecture used on the SPARC, which still didn’t support optimizations, and I got the Pascal frontend development plus backend/linker modifications, interfaces, libraries and utilities. DR/1 was to ship in January with the scheduled launch of the first Power Macintoshes. In the mean time, I dropped my Masters and stopped teaching. I was giving lectures at the university for the past few months along with working on my Masters and working part-time on Metrowerks compilers.

MPW Pascal was the chosen dialect because it’s the de facto standard Pascal dialect on Macintosh. THINK Pascal wasn’t supported and relates heavily to MPW Pascal except for a few minor differences. The biggest problem involved in developing CodeWarrior Pascal was the universal interfaces. Since Apple decided not to support Pascal anymore, the new interfaces developed for the introduction of the PowerPC were made, keeping the PowerPC calling conventions in mind and making use of C’s syntactic capabilities (for example, the CONST keyword is meant to specify an invariant pointer parameter and doesn’t have a Pascal equivalent).

The change from 68K to PPC calling conventions was dramatic for Pascal as the passing of value records and arrays are not the same. There were two possibilities: either support the 68K calling conventions on the PowerPC (thus breaking the calling conventions adopted for all languages, which were inherited from IBM’s AIX machines and provide a seamless common way of doing cross-language, cross-vendor routine calls) or modify the interfaces to render the expected parameter passing. The 68K conventions pass every record and array bigger than 4 bytes by passing a pointer. The PowerPC passes value records into registers and on the stack, and all arrays by pointer regardless of the size. To be able to match both PowerPC and 68K conventions with the same set of interfaces could have been achieved by using a new parameter passing method using the CONST keyword that would have the semantics of a value parameter and an efficient passing implementation. This solution wasn’t taken because it would have broken some compilers. The retained solution was to use VAR parameters because they force the use of pointers, but it has the drawback of breaking some user code, especially in the case of packed arrays and records.

The other problem encountered on the PowerPC is the signatures. They are packed arrays of 4 chars, so they’d have to be passed by pointer. But their C equivalent is an unsigned long, thus value not pointers. To get this to work I had to introduce on PowerPC an UNSIGNEDLONG data type that’s compatible with packed arrays of 4 chars so OSTYPE can be used without problems. After 2 years of use, this solution to the Universal Interfaces problem has proven to be the right one. Another conclusion that comes up is the need to add a procedural data type to Pascal. The new data type enables the compiler to do type checking on the callback routines that get passed either to user code or the toolbox. This type checking capability has proven to be very effective in the porting of code from 68K to PowerPC.

Dave: So at this point, we have the first CodeWarrior IDE with Pascal and C/C++. Since plugins weren’t introduced till CW6/7, how did the Pascal compiler work?

Marcel: The first releases of CodeWarrior didn’t used the plugins architecture but a common IDE was always in the air as the cornerstone of CodeWarrior. The new PowerPC machines had more resources and made such a design more interesting for an entire IDE. So along with the C/C++ compiler, the Pascal compiler was compiled and linked along with the IDE sources. It wasn’t that the Macintoshes were too slow or the resources poor, it was just that it wasn’t the way to do things. People knew about their machine constraints and didn’t go for blue sky, so the applications were kind of in scale with the hardware capabilities. Now that we have faster and bigger machines it is possible to add on facilities to the programs and these added facilities eat up not only disk space but also memory. So having the ability to load on demand various parts of a program has been around almost as long as computers. It’s the way of doing it that changes over time and across platforms.

Dave: Can You talk about the difference between the C++ “value model” and Object Pascal’s “reference” model?

Marcel: The object model is the underlying runtime model that affects the aspect and behavior of objects. In Object Pascal the object model used is known as the reference model because you have to explicitly invoke the creation and deletion of objects. On the other hand, C++ and Turbo Pascal use the value model which involves far more complex semantics for manipulating objects. People often mix method binding with the object model. This accounts for some misconceptions. In Object Pascal, the language only allows compile time binding determination for ‘inherited’ method calls. All the other methods can be overridden, thus forcing late binding which can be changed by a clever linker for monomorphic methods (methods that are never overridden within the program).

In C++, member functions need the ‘virtual’ keyword to specify polymorphism, thus helping the compiler decide how to perform the method call. (It gets more complicated when multiple inheritance is involved.) This binding facility is partially lifted by the introduction of procedural types in CodeWarrior Pascal, but still has to be hand constructed along with the data fields when the object gets created. The difference between object models comes to light when you look at the copy semantics. In Object Pascal, assigning one object to another, passing it as a value parameter or returning one as a function result doesn’t create a new instance as in C++ (and associated copy constructors) or as in Turbo Pascal (bug prone object casting), but only copies a reference. In Object Pascal cloning an object requires a method call and is explicit. This greatly simplifies the complexity of the program without limiting the functionality.

Dave: What are some of the differences between CodeWarrior Object Pascal and other dialects of Object Pascal?

Marcel: There are as many Pascal dialects as there are vendors. One of the biggest contenders is Turbo Pascal. The differences can be categorized into three fields; runtime support (mostly IO and platform specific stuff), the enhanced syntax, and finally the class and object models. We’ve already discussed the object model. The most apparent IO difference between Object Pascal and Turbo Pascal is TP’s assign routine, which binds a logical file to a physical file. Under Object Pascal this is performed directly by the opening routines.

The other IO differences lie in file access semantics, mostly for the handling of binary files. The original Pascal’s (and also the ANS standard) way of dealing with them is using get/put and direct file access thru the caret operator ‘file^’. The object support is very different. OP implements a very simple syntax that hasn’t evolved in about 10 years, whereas TP went through a constant evolution of their implementation. This is clearly an area where we have to expand OP’s capabilities because it really represents an advantage to programmers to have a more flexible implementation.

Dave: What are you working on now?

Marcel: My group is currently working on a Windows version of CodeWarrior Pascal. We are also developing a tool that will automate the use of C precompiled headers within Pascal as Pascal support is more and more lacking within Apple and nonexistent on Windows.

Dave: What do see in the future for yourself and for Pascal?

Marcel: I think in the near future we’re going to see some kind of reevaluation of project development using C/C++ as metrics, and studies are going to circulate. I think that there could be some kind of backlash toward Pascal and Ada if the figures show that C/C++ didn’t deliver the expected results. As far as Pascal goes, from the market share perspectives, Pascal is a player in the academic market as most attempts to move to C and C++ didn’t work very well.

On the other hand, in software engineering things are different. Pascal would have to evolve much faster to meet today’s software engineering needs and standardize on a wide variety of platforms. Even then I’m not too sure about the prospects. As for me, I’m linked to Pascal as I want to evolve CodeWarrior’s implementation of Object Pascal to be a player in both the Macintosh and Windows Pascal market.

 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Dropbox 193.4.5594 - Cloud backup and sy...
Dropbox is a file hosting service that provides cloud storage, file synchronization, personal cloud, and client software. It is a modern workspace that allows you to get to all of your files, manage... Read more
Google Chrome 122.0.6261.57 - Modern and...
Google Chrome is a Web browser by Google, created to be a modern platform for Web pages and applications. It utilizes very fast loading of Web pages and has a V8 engine, which is a custom built... Read more
Skype 8.113.0.210 - Voice-over-internet...
Skype is a telecommunications app that provides HD video calls, instant messaging, calling to any phone number or landline, and Skype for Business for productive cooperation on the projects. This... Read more
Tor Browser 13.0.10 - Anonymize Web brow...
Using Tor Browser you can protect yourself against tracking, surveillance, and censorship. Tor was originally designed, implemented, and deployed as a third-generation onion-routing project of the U.... Read more
Deeper 3.0.4 - Enable hidden features in...
Deeper is a personalization utility for macOS which allows you to enable and disable the hidden functions of the Finder, Dock, QuickTime, Safari, iTunes, login window, Spotlight, and many of Apple's... Read more
OnyX 4.5.5 - Maintenance and optimizatio...
OnyX is a multifunction utility that you can use to verify the startup disk and the structure of its system files, to run miscellaneous maintenance and cleaning tasks, to configure parameters in the... Read more
Hopper Disassembler 5.14.1 - Binary disa...
Hopper Disassembler is a binary disassembler, decompiler, and debugger for 32- and 64-bit executables. It will let you disassemble any binary you want, and provide you all the information about its... Read more

Latest Forum Discussions

See All

Zenless Zone Zero opens entries for its...
miHoYo, aka HoYoverse, has become such a big name in mobile gaming that it's hard to believe that arguably their flagship title, Genshin Impact, is only three and a half years old. Now, they continue the road to the next title in their world, with... | Read more »
Live, Playdate, Live! – The TouchArcade...
In this week’s episode of The TouchArcade Show we kick things off by talking about all the games I splurged on during the recent Playdate Catalog one-year anniversary sale, including the new Lucas Pope jam Mars After Midnight. We haven’t played any... | Read more »
TouchArcade Game of the Week: ‘Vroomies’
So here’s a thing: Vroomies from developer Alex Taber aka Unordered Games is the Game of the Week! Except… Vroomies came out an entire month ago. It wasn’t on my radar until this week, which is why I included it in our weekly new games round-up, but... | Read more »
SwitchArcade Round-Up: ‘MLB The Show 24’...
Hello gentle readers, and welcome to the SwitchArcade Round-Up for March 15th, 2024. We’re closing out the week with a bunch of new games, with Sony’s baseball franchise MLB The Show up to bat yet again. There are several other interesting games to... | Read more »
Steam Deck Weekly: WWE 2K24 and Summerho...
Welcome to this week’s edition of the Steam Deck Weekly. The busy season has begun with games we’ve been looking forward to playing including Dragon’s Dogma 2, Horizon Forbidden West Complete Edition, and also console exclusives like Rise of the... | Read more »
Steam Spring Sale 2024 – The 10 Best Ste...
The Steam Spring Sale 2024 began last night, and while it isn’t as big of a deal as say the Steam Winter Sale, you may as well take advantage of it to save money on some games you were planning to buy. I obviously recommend checking out your own... | Read more »
New ‘SaGa Emerald Beyond’ Gameplay Showc...
Last month, Square Enix posted a Let’s Play video featuring SaGa Localization Director Neil Broadley who showcased the worlds, companions, and more from the upcoming and highly-anticipated RPG SaGa Emerald Beyond. | Read more »
Choose Your Side in the Latest ‘Marvel S...
Last month, Marvel Snap (Free) held its very first “imbalance" event in honor of Valentine’s Day. For a limited time, certain well-known couples were given special boosts when conditions were right. It must have gone over well, because we’ve got a... | Read more »
Warframe welcomes the arrival of a new s...
As a Warframe player one of the best things about it launching on iOS, despite it being arguably the best way to play the game if you have a controller, is that I can now be paid to talk about it. To whit, we are gearing up to receive the first... | Read more »
Apple Arcade Weekly Round-Up: Updates an...
Following the new releases earlier in the month and April 2024’s games being revealed by Apple, this week has seen some notable game updates and events go live for Apple Arcade. What The Golf? has an April Fool’s Day celebration event going live “... | Read more »

Price Scanner via MacPrices.net

Apple Education is offering $100 discounts on...
If you’re a student, teacher, or staff member at any educational institution, you can use your .edu email address when ordering at Apple Education to take $100 off the price of a new M3 MacBook Air.... Read more
Apple Watch Ultra 2 with Blood Oxygen feature...
Best Buy is offering Apple Watch Ultra 2 models for $50 off MSRP on their online store this week. Sale prices available for online orders only, in-store prices may vary. Order online, and choose... Read more
New promo at Sams Club: Apple HomePods for $2...
Sams Club has Apple HomePods on sale for $259 through March 31, 2024. Their price is $40 off Apple’s MSRP, and both Space Gray and White colors are available. Sale price is for online orders only, in... Read more
Get Apple’s 2nd generation Apple Pencil for $...
Apple’s Pencil (2nd generation) works with the 12″ iPad Pro (3rd, 4th, 5th, and 6th generation), 11″ iPad Pro (1st, 2nd, 3rd, and 4th generation), iPad Air (4th and 5th generation), and iPad mini (... Read more
10th generation Apple iPads on sale for $100...
Best Buy has Apple’s 10th-generation WiFi iPads back on sale for $100 off MSRP on their online store, starting at only $349. With the discount, Best Buy’s prices are the lowest currently available... Read more
iPad Airs on sale again starting at $449 on B...
Best Buy has 10.9″ M1 WiFi iPad Airs on record-low sale prices again for $150 off Apple’s MSRP, starting at $449. Sale prices for online orders only, in-store price may vary. Order online, and choose... Read more
Best Buy is blowing out clearance 13-inch M1...
Best Buy is blowing out clearance Apple 13″ M1 MacBook Airs this weekend for only $649.99, or $350 off Apple’s original MSRP. Sale prices for online orders only, in-store prices may vary. Order... Read more
Low price alert! You can now get a 13-inch M1...
Walmart has, for the first time, begun offering new Apple MacBooks for sale on their online store, albeit clearance previous-generation models. They now have the 13″ M1 MacBook Air (8GB RAM, 256GB... Read more
Best Apple MacBook deal this weekend: Get the...
Apple has 13″ M2 MacBook Airs available for only $849 today in their Certified Refurbished store. These are the cheapest M2-powered MacBooks for sale at Apple. Apple’s one-year warranty is included,... Read more
New 15-inch M3 MacBook Air (Midnight) on sale...
Amazon has the new 15″ M3 MacBook Air (8GB RAM/256GB SSD/Midnight) in stock and on sale today for $1249.99 including free shipping. Their price is $50 off MSRP, and it’s the lowest price currently... Read more

Jobs Board

Early Preschool Teacher - Glenda Drive/ *Appl...
Early Preschool Teacher - Glenda Drive/ Apple ValleyTeacher Share by Email Share on LinkedIn Share on Twitter Read more
Senior Software Engineer - *Apple* Fundamen...
…center of Microsoft's efforts to empower our users to do more. The Apple Fundamentals team focused on defining and improving the end-to-end developer experience in Read more
Relationship Banker *Apple* Valley Main - W...
…Alcohol Policy to learn more. **Company:** WELLS FARGO BANK **Req Number:** R-350696 **Updated:** Mon Mar 11 00:00:00 UTC 2024 **Location:** APPLE VALLEY,California Read more
Medical Assistant - Surgical Oncology- *Apple...
Medical Assistant - Surgical Oncology- Apple Hill WellSpan Medical Group, York, PA | Nursing | Nursing Support | FTE: 1 | Regular | Tracking Code: 200555 Apply Now Read more
Early Preschool Teacher - Glenda Drive/ *Appl...
Early Preschool Teacher - Glenda Drive/ Apple ValleyTeacher Share by Email Share on LinkedIn Share on Twitter Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.