[fpc-pascal] Re: MacMode More Info / Beginning Mac Dev

Richard Ward roward at mac.com
Fri Apr 10 18:45:04 CEST 2009

Pierre Paré wrote:

> If not the appropriate list for this question, would you redirect  
> the request

-- Also, check out the MacPascal List, the Lazarus list and the FPC/ 
Lazarus Wiki PAges

> I installed FPC with XCode on an iMac OS X 10.5
> I am not a developer  , I want to get back at programming for fun.

-- To start out, I would recommend Ingemar's LW IDE for the Mac.  It  
performs/hides a lot of the complexity of X-code so it is easy to  
create quick programs - but it also allows you to write large programs  
as well.   I have had very good experience with it and have not had to  
migrate to X-code.   The other option is to try out Lazarus and its  
IDE.   This is a bit more involved but has more support for dealing  
with the FPC and Lazarus class libraries.   Also, there is a  
relatively new mac IDE out called Pascal Gladiator.  I have not looked  
at either much.   Here is a link for LW IDE: 


and the FPC's main wiki page:


> I know Pascal well enough but have no prior knowledge on the "Mac  
> Dialect"
> I never used Delphi nor TurboPascal per se.
> I would like more complete syntax and implementation infos on the  
> "Mac Dialect" in FPC
> What is "Object Pascal, Mac style" in FPC :
> 	which object model : like FPC object and record type or like  
> reference FPC class type ,
> 	which class and methods modifiers can or must or must not be used  
> (abstract, class or static, interfaces),
> 	which units may, must or must not be used
> 		for base object TObject : from Object or System unit
> 		for framework : TCollection , TStringList from Object or Class unit

-- There are two Object Oriented (OO) dialects in FPC.  They are what  
I call the Object dialect and the Class dialect.   The former is  
compatible with an older Turbo Pascal implementation while the latter  
is based upon Delphi's implementation.  It seems that the Class/Delphi  
dialect is used more.   I used to know a little about the apple/mac  
Object Pascal dialects and the FPC dialects don't exactly match.   I  
have written a wiki tutorial on the FPC Object dialect and was taking  
a break before starting a tutorial on the FPC Class dialect.   The  
Class dialect tutorial will use the existing tutorial as a starting  
point so it wouldn't hurt you to look at the existing tutorial  
first.   There are several differences but the main change is that the  
Class dialect does not allow you to create static object variables -  
they must be dynamically created - but they don't use the ^ symbol -  
which can be confusing at first.  Here is a link to the object dialect  


You will probably want to read the FPC documentation along with  
this.   The object dialects are described in chapters 5 and 6 of the  
FPC Language Reference Guide.   I would suggest at least skimming over  
the other chapters as well since FPC has included some features/ 
changes to Pascal which you may not be aware of coming from the older  
Apple dialects.   Here is link to the Lang Ref Guide and RTL guide  
(and other docs) which include information on the class libraries and  
the FPC standard system library which is very handy.   For example, if  
you do any standard file I/O, the RTL doc is very handy since those  
routines are different from the versions I was used to on THINK Pascal  
for the Mac.


And just recently, I found a publicly available link to a chapter from  
a published book currently available on the web which covers the  
Delphi object model.   It's not exactly a tutorial but it is a nice  
synopsis to have available to make sense of the FPC reference guide.

Once you read over those, many of your above questions will probably  
be answered :)

Chapter 2 complete


Entire Book Preview, 95% complete


> Do I need MacMode or will any other mode do ? Can interfaces,  
> generics be used ?

> Joost wrote:
> Then don't use it. The compiler-modes are there to make it easier for
> people to switch from the dialect they are used to. So only when you  
> are
> used to use 'mac-pascal' you could decide to use the macpas-mode.

--  I agree, I started out using macpas mode to port some old stuff  
over and now I am regretting using it for new things.  The main  
problem for new projects is that macpas mode is not compatible with  
objfpc mode which you need for classes.   You can use the two modes  
individually in separate units but that can get aggravating.   The  
other mode you will come across is delphi mode which can be used  
instead of objfpc mode for Classes but since I personally am not  
interested in being compatible with Delphi, I use objfpc mode.  I'm  
not sure if Lazarus requires delphi mode or if objfpc mod is ok.

> Which object model will I need with Carbon librairies. It seems that  
> accesing Cocoa is more difficult.

--  I started out in FPC doing some carbon programming.   The one  
thing to be aware of is that Apple has given plenty of strong hints  
that Carbon will become obsolete in so many words.   It has to do with  
64 bit compatibility which carbon is not being updated for.   It is  
likely, Carbon will be supported for awhile but Cocoa is now Apple's  
(really only) emphasis now.   This presents a problem since there is  
no fully implemented "cocoa" mode or unit for FPC yet.   There are  
various cocoa conversion efforts currently going on within FPC but an  
official production release is a ways off.   Others might be able to  
comment more intelligently on this subject though.   I would suggest  
learning the FPC object dialects and by the time you are comfortable  
with them, FPC cocoa support may be closer to completion.  That is  
what I am currently doing.  You can also study Objective C and Cocoa  
from Apple's documentation if you are adventurous.   :)

If you want to get up to speed on Carbon programming in FPC, I have  
some very detailed tutorial/demo programs available from Pascal  
Central or on my own Pascal References page.

These are strictly carbon and do not include any object or class  
objects.   It also requires macpas mode and the MacOSAll.p unit.  I'm  
wondering if I can convert these simple demos so they don't depend on  
macpas mode but haven't had time to explore that much yet.


Ingemar's LW IDE includes many demo programs and utility units for mac  
user interface as well - mostly carbon and many graphics programs,  
including a carbon shell program called "Skel."
> I am having a hard time finding (old) MPW, Think or CodeWarrior  
> Pascal references manuals for the Pascal on Macintosh.
> Pascal Central has some on general standards references and code  
> banks but I didn't find technical language references specific to  
> the Mac. I would appreciate some links.
In addition to the links and references I mentioned above, here is a  
direct link to the fpc wiki mac pascal page.


and lazarus


hope that gets you going. Have fun :)

  - ROW
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20090410/63f0af43/attachment.html>

More information about the fpc-pascal mailing list