Object Pascal
   HOME

TheInfoList



OR:

Object Pascal is an extension to the programming language
Pascal Pascal, Pascal's or PASCAL may refer to: People and fictional characters * Pascal (given name), including a list of people with the name * Pascal (surname), including a list of people and fictional characters with the name ** Blaise Pascal, Frenc ...
that provides
object-oriented programming Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of ...
(OOP) features such as classes and
methods Method ( grc, μέθοδος, methodos) literally means a pursuit of knowledge, investigation, mode of prosecuting such inquiry, or system. In recent centuries it more often means a prescribed process for completing a task. It may refer to: *Scien ...
. The language was originally developed by
Apple Computer Apple Inc. is an American multinational technology company headquartered in Cupertino, California, United States. Apple is the largest technology company by revenue (totaling in 2021) and, as of June 2022, is the world's biggest company ...
as ''Clascal'' for the Lisa Workshop development system. As Lisa gave way to
Macintosh The Mac (known as Macintosh until 1999) is a family of personal computers designed and marketed by Apple Inc., Apple Inc. Macs are known for their ease of use and minimalist designs, and are popular among students, creative professionals, and ...
, Apple collaborated with Niklaus Wirth, the author of Pascal, to develop an officially standardized version of Clascal. This was renamed Object Pascal. Through the mid-1980s, Object Pascal was the main programming language for early versions of the MacApp application framework. The language lost its place as the main development language on the Mac in 1991 with the release of the C++-based MacApp 3.0. Official support ended in 1996.
Symantec Symantec may refer to: *An American consumer software company now known as Gen Digital Inc. *A brand of enterprise security software purchased by Broadcom Inc. Broadcom Inc. is an American designer, developer, manufacturer and global supplier ...
also developed a
compiler In computing, a compiler is a computer program that translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily used for programs tha ...
for Object Pascal for their Think Pascal product, which could compile programs much faster than Apple's own Macintosh Programmer's Workshop (MPW). Symantec then developed the Think Class Library (TCL), based on MacApp concepts, which could be called from both Object Pascal and
THINK C Think C (stylized as THINK C; formerly Lightspeed C) is an extension of the C programming language for the classic Mac OS developed by Think Technologies, released first in mid-1986. THINK was founded by Andrew Singer, Frank Sinton & Mel Conway. ...
. The Think suite largely displaced MPW as the main development platform on the Mac in the late 1980s. Symantec ported Object Pascal to the PC, and developed a similar object framework on that platform. In contrast to TCL, which eventually migrated to C++, the PC libraries remained mainly based on Pascal. Borland added support for object-oriented programming to Turbo Pascal 5.5, which would eventually become the basis for the Object Pascal dialect used in Delphi. Delphi remained mainstream for business applications on the PC into the early 2000s, and was partly displaced in the 2000s with the introduction of the
.NET Framework The .NET Framework (pronounced as "''dot net"'') is a proprietary software framework developed by Microsoft that runs primarily on Microsoft Windows. It was the predominant implementation of the Common Language Infrastructure (CLI) until bein ...
.


History


Apple Pascal

Pascal became a major language in the programming world in the 1970s, with high-quality implementations on most minicomputer platforms and microcomputers. Among the later was the
UCSD Pascal UCSD Pascal is a Pascal programming language system that runs on the UCSD p-System, a portable, highly machine-independent operating system. UCSD Pascal was first released in 1977. It was developed at the University of California, San Diego (U ...
system, which compiled to an intermediate ''p-System'' code format that could then run on multiple platforms. Apple licensed UCSD and used it as the basis for their Apple Pascal system for the
Apple II The Apple II (stylized as ) is an 8-bit home computer and one of the world's first highly successful mass-produced microcomputer products. It was designed primarily by Steve Wozniak; Jerry Manock developed the design of Apple II's foam-m ...
and Apple III. Pascal became one of the major languages in the company in this period. With the start of the Apple Lisa project, Pascal was selected as the main programming language of the platform, although this time as a ''compiler'' in contrast to the p-System ''interpreter''.


Clascal and Apple's early Object Pascal

Object Pascal is an extension of the Pascal language that was developed at
Apple Computer Apple Inc. is an American multinational technology company headquartered in Cupertino, California, United States. Apple is the largest technology company by revenue (totaling in 2021) and, as of June 2022, is the world's biggest company ...
by a team led by Larry Tesler in consultation with Niklaus Wirth, the inventor of Pascal. It is descended from an earlier object-oriented version of Pascal named Clascal, which was available on the Lisa computer. Object Pascal was needed to support MacApp, an expandable Macintosh application framework that would now be termed a class library. Object Pascal extensions, and MacApp, were developed by Barry Haynes, Ken Doyle, and Larry Rosenstein, and were tested by Dan Allen. Larry Tesler oversaw the project, which began very early in 1985 and became a product in 1986. An Object Pascal extension was also implemented in the Think Pascal
integrated development environment An integrated development environment (IDE) is a software application that provides comprehensive facilities to computer programmers for software development. An IDE normally consists of at least a source code editor, build automation tools ...
(IDE). The IDE includes the compiler and an editor with syntax highlighting and checking, a powerful debugger, and a class library. Many developers preferred Think Pascal over Apple's implementation of Object Pascal because Think Pascal offered a much faster compile– link–debug cycle, and tight integration of its tools. The last official release of Think Pascal was 4.01, in 1992.
Symantec Symantec may refer to: *An American consumer software company now known as Gen Digital Inc. *A brand of enterprise security software purchased by Broadcom Inc. Broadcom Inc. is an American designer, developer, manufacturer and global supplier ...
later released an unofficial version 4.5d4 at no charge. Apple dropped support for Object Pascal when they moved from
Motorola 68000 series The Motorola 68000 series (also known as 680x0, m68000, m68k, or 68k) is a family of 32-bit complex instruction set computer (CISC) microprocessors. During the 1980s and early 1990s, they were popular in personal computers and workstations and ...
chips to IBM's PowerPC architecture in 1994. MacApp 3.0, had already been rewritten in C++ and ported to this platform.
Metrowerks Metrowerks was a company that developed software development tools for various desktop, handheld, embedded, and gaming platforms. Its flagship product, CodeWarrior, comprised an IDE, compilers, linkers, debuggers, libraries, and related tools. I ...
offered with CodeWarrior an Object Pascal compiler for Macintosh that targeted both
68k The Motorola 68000 series (also known as 680x0, m68000, m68k, or 68k) is a family of 32-bit complex instruction set computer (CISC) microprocessors. During the 1980s and early 1990s, they were popular in personal computers and workstations and w ...
and PowerPC, both in their IDE and as MPW tools. Macintosh developers using Object Pascal had a path to port to the PowerPC, even architecture after both Apple and Symantec dropped support. MacApp 2.0, written in Object Pascal, was ported to the PowerPC using CodeWarrior.


Borland, Inprise, CodeGear, and Embarcadero years

In 1986, Borland introduced similar extensions, also named Object Pascal, to the Turbo Pascal product for the Macintosh, and in 1989 for Turbo Pascal 5.5 for DOS. When Borland refocused from DOS to
Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for se ...
in 1994, they created a successor to Turbo Pascal, named Delphi, and introduced a new set of extensions to create what is now known as the Delphi language. The development of Delphi started in 1993 and Delphi 1.0 was officially released in the United States on 14 February 1995. While code using the Turbo Pascal object model could still be compiled, Delphi featured a new syntax using the keyword class in preference to object, the Create constructor and a virtual Destroy destructor (and negating having to call the New and Dispose procedures), properties, method pointers, and some other things. These were inspired by the ISO working draft for object-oriented extensions, but many of the differences from Turbo Pascal's dialect (such as the draft's requirement that all methods be virtual) were ignored. The Delphi language has continued to evolve over the years to support constructs such as dynamic arrays,
generics Generic or generics may refer to: In business * Generic term, a common name used for a range or class of similar things not protected by trademark * Generic brand, a brand for a product that does not have an associated brand or trademark, other ...
and anonymous methods. The old object syntax introduced by Apple ("Old-Style Object Types") is still supported.


Versions

* Borland used the name ''Object Pascal'' for the programming language in the first versions, but later renamed it to ''Delphi''.
Compiler In computing, a compiler is a computer program that translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily used for programs tha ...
s that claim to be compatible with Object Pascal are often trying to be compatible with Delphi
source code In computing, source code, or simply code, is any collection of code, with or without comments, written using a human-readable programming language, usually as plain text. The source code of a program is specially designed to facilitate the ...
. Because Delphi is a
trademark A trademark (also written trade mark or trade-mark) is a type of intellectual property consisting of a recognizable sign, design, or expression that identifies products or services from a particular source and distinguishes them from ot ...
, compatible compilers continue using the name ''Object Pascal''. * Embarcadero Technologies, which purchased Delphi in 2008, sells the Delphi
integrated development environment An integrated development environment (IDE) is a software application that provides comprehensive facilities to computer programmers for software development. An IDE normally consists of at least a source code editor, build automation tools ...
(IDE) that compiles the Delphi dialect of Object Pascal to
Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for se ...
and
macOS macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac computers. Within the market of desktop and la ...
, iOS, Android and Web. * .NET support existed from Delphi 8 through Delphi 2005, 2006, and 2007, which now has been replaced by another language, ''Oxygene'' (see below), which is not fully backward-compatible. * The Oxygene language developed by
RemObjects Software RemObjects Software is an American software company founded in 2002 by Alessandro Federici and Marc Hoffman. It develops and offers tools and libraries for software developers on a variety of development platforms, including Embarcadero Delphi, M ...
targets the Common Language Infrastructure, the Java (software platform) Runtime Environment and
Apple An apple is an edible fruit produced by an apple tree (''Malus domestica''). Apple trees are cultivated worldwide and are the most widely grown species in the genus '' Malus''. The tree originated in Central Asia, where its wild ancest ...
's
Cocoa Cocoa may refer to: Chocolate * Chocolate * ''Theobroma cacao'', the cocoa tree * Cocoa bean, seed of ''Theobroma cacao'' * Chocolate liquor, or cocoa liquor, pure, liquid chocolate extracted from the cocoa bean, including both cocoa butter an ...
frameworks for iOS and
macOS macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac computers. Within the market of desktop and la ...
. * The open source Free Pascal project allows the language to be compiled for a wide range of
operating system An operating system (OS) is system software that manages computer hardware, software resources, and provides common daemon (computing), services for computer programs. Time-sharing operating systems scheduler (computing), schedule tasks for ef ...
s, including
Linux Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, whi ...
( 32-bit,
64-bit In computer architecture, 64-bit integers, memory addresses, or other data units are those that are 64 bits wide. Also, 64-bit CPUs and ALUs are those that are based on processor registers, address buses, or data buses of that size. A ...
), FreeBSD, Classic Mac OS,
macOS macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac computers. Within the market of desktop and la ...
, Solaris, Windows API (32, 64, CE), the ARM instruction set architecture (ISA), and several other hardware architectures. The first version of Free Pascal for the iPhone
software development kit A software development kit (SDK) is a collection of software development tools in one installable package. They facilitate the creation of applications by having a compiler, debugger and sometimes a software framework. They are normally specific ...
(SDK) 2.''x'' was announced on January 17, 2009. * The Smart Pascal language targets
ECMAScript ECMAScript (; ES) is a JavaScript standard intended to ensure the interoperability of web pages across different browsers. It is standardized by Ecma International in the documenECMA-262 ECMAScript is commonly used for client-side scripti ...
JavaScript JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of websites use JavaScript on the client side for webpage behavior, of ...
and is used in Smart Mobile Studio, written by Jon Lennart Aasenden and published by Optimale Systemer (2012). The language greatly simplifies HTML5 development through object-oriented, and
rapid application development Rapid application development (RAD), also called rapid application building (RAB), is both a general term for adaptive software development approaches, and the name for James Martin's method of rapid development. In general, RAD approaches to ...
(RAD) methods. Smart Pascal integrates tightly with established technologies such as
node.js Node.js is an open-source server environment. Node.js is cross-platform and runs on Windows, Linux, Unix, and macOS. Node.js is a back-end JavaScript runtime environment. Node.js runs on the V8 JavaScript Engine and executes JavaScript cod ...
, Embarcadero DataSnap, and Remobjects SDK to produce high-performance
client–server model The client–server model is a distributed application structure that partitions tasks or workloads between the providers of a resource or service, called servers, and service requesters, called clients. Often clients and servers communicate ov ...
web applications. The language allows easy creation of visual components and reusable libraries. The Smart Pascal dialect stems from the DWScript language, extended to better integrate with the JavaScript environment and libraries, such as asm sections which are plain JavaScript but have access to Pascal symbols, or ''external'' classes which map directly to prototypal JavaScript classes. Smart Pascal introduces true inheritance, classes, partial classes, interfaces, a
virtual method table In computer programming, a virtual method table (VMT), virtual function table, virtual call table, dispatch table, vtable, or vftable is a mechanism used in a programming language to support dynamic dispatch (or run-time method binding). Whe ...
and many other advanced constructs which are not a part of JavaScript by default. * MIDletPascal runs on a Java virtual machine (JVM)
bytecode Bytecode (also called portable code or p-code) is a form of instruction set designed for efficient execution by a software interpreter. Unlike human-readable source code, bytecodes are compact numeric codes, constants, and references (norma ...
platform; which Free Pascal also targets, with far more features. * The Morfik Pascal language, developed by Morfik, targets Ajax-enabled Web applications. The compiler is built into the company's AppsBuilder IDE and allows Object Pascal code to be used in implementing code to execute in a browser or server. It uses the Free Pascal compiler to generate native binaries from Object Pascal. * The open source GNU Pascal compiler is available as a front-end to the
GNU Compiler Collection The GNU Compiler Collection (GCC) is an optimizing compiler produced by the GNU Project supporting various programming languages, hardware architectures and operating systems. The Free Software Foundation (FSF) distributes GCC as free softwar ...
, which implements the
International Organization for Standardization The International Organization for Standardization (ISO ) is an international standard development organization composed of representatives from the national standards organizations of member countries. Membership requirements are given in A ...
(ISO) 7185 Pascal standard, and most of the ISO 10206 Extended Pascal standard. * Turbo51 is a free compiler to program Intel 8051 chips. * WDSibyl is an open source Delphi-like IDE and compiler available for
Microsoft Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for ...
and OS/2, and is a commercial Turbo Pascal compatible environment released by a company named Speedsoft that was later developed into a Delphi-like RAD environment named Sybil, and then open sourced under the GPL when that company closed down. Wolfgang Draxler (WD) now maintains the software. The compiler used seems to be located in a DLL and is not open-source.


Compilers

Object Pascal
compiler In computing, a compiler is a computer program that translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily used for programs tha ...
s are available for a wide range of
operating system An operating system (OS) is system software that manages computer hardware, software resources, and provides common daemon (computing), services for computer programs. Time-sharing operating systems scheduler (computing), schedule tasks for ef ...
s and architectures. * Delphi is probably the best known compiler. It is the successor of the highly successful Borland Pascal and Turbo Pascal product line. It targets
Windows 9x Windows 9x is a generic term referring to a series of Microsoft Windows computer operating systems produced from 1995 to 2000, which were based on the Windows 95 kernel and its underlying foundation of MS-DOS, both of which were updated in sub ...
(Delphi 2007 and older), the
Windows NT Windows NT is a proprietary graphical operating system produced by Microsoft, the first version of which was released on July 27, 1993. It is a processor-independent, multiprocessing and multi-user operating system. The first version of Win ...
family,
.NET Framework The .NET Framework (pronounced as "''dot net"'') is a proprietary software framework developed by Microsoft that runs primarily on Microsoft Windows. It was the predominant implementation of the Common Language Infrastructure (CLI) until bein ...
(Delphi 8, 2005, 2007),
macOS macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac computers. Within the market of desktop and la ...
(Delphi XE2 and later), iOS (Delphi XE2 and later, generating native binaries in XE4 and later), Android (Delphi XE5 and later, generating native binaries in XE5 and later). Support for .NET finally became a separate product known as Oxygene (see below). * Free Pascal Compiler (FPC) is an open-source Object Pascal compiler that supports many Pascal dialects, including Turbo Pascal 7, Delphi, and others. Currently, FPC can generate code for
IA-32 IA-32 (short for "Intel Architecture, 32-bit", commonly called i386) is the 32-bit version of the x86 instruction set architecture, designed by Intel and first implemented in the 80386 microprocessor in 1985. IA-32 is the first incarnatio ...
, x86-64, PowerPC,
SPARC SPARC (Scalable Processor Architecture) is a reduced instruction set computer (RISC) instruction set architecture originally developed by Sun Microsystems. Its design was strongly influenced by the experimental Berkeley RISC system develope ...
, and ARM processors, and for several operating systems, including
Microsoft Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for ...
,
Linux Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, whi ...
, FreeBSD, Classic Mac OS, and
macOS macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac computers. Within the market of desktop and la ...
(with an
Xcode Xcode is Apple's integrated development environment (IDE) for macOS, used to develop software for macOS, iOS, iPadOS, watchOS, and tvOS. It was initially released in late 2003; the latest stable release is version 14.2, released on December 13, ...
integration kit). Several separate projects exist to facilitate rapid application development with FPC, the most prominent one being
Lazarus (IDE) Lazarus is a free cross-platform visual integrated development environment (IDE) for rapid application development (RAD) using the Free Pascal compiler. Its goal is to provide an easy-to-use development environment for programmers developing wit ...
. * GNU Pascal (a separately distributed part of the
GNU Compiler Collection The GNU Compiler Collection (GCC) is an optimizing compiler produced by the GNU Project supporting various programming languages, hardware architectures and operating systems. The Free Software Foundation (FSF) distributes GCC as free softwar ...
), while not formally aimed at the Delphi dialect of Pascal, does contain a Turbo Pascal compatibility mode, and is very slowly incorporating a few Delphi language features. It is unsuitable for recompiling large bodies of Delphi code directly, but is notable as having prolific support for operating systems and hardware architectures. * Oxygene (formerly ''Chrome'') is an Object Pascal compiler from
RemObjects Software RemObjects Software is an American software company founded in 2002 by Alessandro Federici and Marc Hoffman. It develops and offers tools and libraries for software developers on a variety of development platforms, including Embarcadero Delphi, M ...
that integrates into Microsoft Visual Studio. It is also available as free
command-line interface A command-line interpreter or command-line processor uses a command-line interface (CLI) to receive commands from a user in the form of lines of text. This provides a means of setting parameters for the environment, invoking executables and pro ...
compiler that runs native on
CLI CLI may refer to: Computing * Call Level Interface, an SQL database management API * Command-line interface, of a computer program * Command-line interpreter or command language interpreter; see List of command-line interpreters * CLI (x86 instr ...
. It is three compilers in one, each targeting a different platform: Echoes for
.NET Framework The .NET Framework (pronounced as "''dot net"'') is a proprietary software framework developed by Microsoft that runs primarily on Microsoft Windows. It was the predominant implementation of the Common Language Infrastructure (CLI) until bein ...
,
Mono Mono may refer to: Common meanings * Infectious mononucleosis, "the kissing disease" * Monaural, monophonic sound reproduction, often shortened to mono * Mono-, a numerical prefix representing anything single Music Performers * Mono (Japanes ...
, WinRT and Windows Phone 8, Cooper for
JDK The Java Development Kit (JDK) is a distribution of Java Technology by Oracle Corporation. It implements the Java Language Specification (JLS) and the Java Virtual Machine Specification (JVMS) and provides the Standard Edition (SE) of the Java ...
and Android, and Nougat for iOS and
macOS macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac computers. Within the market of desktop and la ...
. * MIDletPascal is a mobile application development tool that generates Java ME bytecode. * PocketStudio is a Pascal-based
integrated development environment An integrated development environment (IDE) is a software application that provides comprehensive facilities to computer programmers for software development. An IDE normally consists of at least a source code editor, build automation tools ...
(IDE) for Palm OS. * Smart Mobile Studio is a source-to-source compiler that transforms Pascal
source code In computing, source code, or simply code, is any collection of code, with or without comments, written using a human-readable programming language, usually as plain text. The source code of a program is specially designed to facilitate the ...
to
JavaScript JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of websites use JavaScript on the client side for webpage behavior, of ...
* Ultibo.org Core is based on Free Pascal, with development in the Lazarus IDE for embedded Raspberry Pi applications.


Legacy products

* Borland Kylix was a
Linux Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, whi ...
variant of Delphi which only targets Intel 32-bit Linux using the Qt library. It does not work out of the box with most modern Linux distributions. *
Virtual Pascal Virtual Pascal is a free 32-bit Pascal compiler, IDE, and debugger for OS/2 and Microsoft Windows, with some limited Linux support. Virtual Pascal was developed by Vitaly Miryanov and later maintained by Allan Mertner. Features The compiler is ...
was a free 32-bit Turbo Pascal and Delphi compatible compiler for mainly OS/2 and Microsoft Windows. Later, it also received a DOS+ Extender and an experimental Linux cross-compiler. The compiler's development stopped at about the level of Delphi 2. In 2007, its official website ceased to operate, and further development ceased.


Interpreters


Pascal Script
(formerly ''InnerFuse'') an
DWScript
(Delphi Web Script) are open-source Object Pascal interpreters and scripting engines written in Delphi. They support subsets of Object Pascal. DWScript can also compile Object Pascal code into JavaScript code (Smart Pascal), and supports just-in-time compilation (JIT). Modern Pascal provides 3 different interpreters: a
command-line interface A command-line interpreter or command-line processor uses a command-line interface (CLI) to receive commands from a user in the form of lines of text. This provides a means of setting parameters for the environment, invoking executables and pro ...
(CLI), Apache Module (Celerity), and CodeRunner (node.js like solution able to handle different scripts per port), besides the ability to compile and protect a script's
source code In computing, source code, or simply code, is any collection of code, with or without comments, written using a human-readable programming language, usually as plain text. The source code of a program is specially designed to facilitate the ...
.


Sample "Hello World" programs

Here are several "Hello World" programs in different Object Pascal versions.


Apple version

program ObjectPascalExample; type THelloWorld = object procedure Put; end; var HelloWorld: THelloWorld; procedure THelloWorld.Put; begin ShowMessage('Hello, World!'); end; begin New(HelloWorld); HelloWorld.Put; Dispose(HelloWorld); end.


Turbo Pascal version

Still supported in Delphi and Free Pascal. FPC also packages its own substitutes for the libraries/units. Delphi doesn't. The Free Pascal 1.0 series and the FPC textmode IDE are the largest open codebases in this dialect. Free Pascal 2.0 was rewritten in a more Delphi-like dialect, and the textmode IDE and related frameworks (Free Vision) are the only parts in the TP version of Object Pascal.


Stack based allocation

program ObjectPascalExample; type THelloWorld = object procedure Put; end; procedure THelloWorld.Put; begin WriteLn('Hello, World!'); end; var HelloWorld: THelloWorld; begin HelloWorld.Put; end.


Heap based allocation

program ObjectPascalExample; type PHelloWorld = ^THelloWorld; THelloWorld = object procedure Put; end; procedure THelloWorld.Put; begin WriteLn('Hello, World!'); end; var HelloWorld: PHelloWorld; begin New(HelloWorld); HelloWorld^.Put; Dispose(HelloWorld); end. Another example: program ObjectPascalExample; type PHelloWorld = ^THelloWorld; THelloWorld = object procedure Put; end; procedure THelloWorld.Put; begin WriteLn('Hello, World!'); end; var HelloWorld: PHelloWorld; HelloWorld2: ^THelloWorld; HelloWorld3: ^THelloWorld; HelloWorld4: PHelloWorld; begin New(HelloWorld); HelloWorld4 := HelloWorld; HelloWorld2 := HelloWorld; New(HelloWorld3); HelloWorld4 := HelloWorld3; HelloWorld2 := HelloWorld3; Dispose(HelloWorld); Dispose(HelloWorld3); end. This works based on pointer copy, unless there is a specific allocation for a deeper copy.


Delphi and Free Pascal version

program ObjectPascalExample; type THelloWorld = class procedure Put; end; procedure THelloWorld.Put; begin Writeln('Hello, World!'); end; var HelloWorld: THelloWorld; begin HelloWorld := THelloWorld.Create; HelloWorld.Put; HelloWorld.Free; end. Note that the object construct is still available in Delphi and Free Pascal.


Modern Pascal version

program ObjectPascalExample; type THelloWorld = class Put:procedure of object; end; procedure THelloWorld.Put; begin Writeln('Hello, World!'); end; procedure THelloWorld.Free; begin // dispose any pointers // end; procedure THelloWorld.Init; begin // initialize variables // link methods (manual RTTI) with Self do begin TMethod(@Put):= THelloWorld.Put, @Self TMethod(@Free):= THelloWorld.Free, @Self End; end; var HelloWorld: THelloWorld; begin HelloWorld.Init; HelloWorld.Put; HelloWorld.Free; end.


Oxygene version

namespace ObjectPascalExample; interface type ConsoleApp = class class method Main; end; THelloWorld = class method Put; end; implementation method THelloWorld.Put; begin Console.WriteLine('Hello, World!'); end; class method ConsoleApp.Main; begin var HelloWorld := new THelloWorld; HelloWorld.Put; end; end.


DWScript (Smart Pascal) version

type THelloWorld = class procedure Put; begin PrintLn('Hello, World!'); end end; var HelloWorld := THelloWorld.Create; HelloWorld.Put; The method implementation can also be made in a distinct location as in other Object Pascal dialects.


Development

Many features have been introduced continuously to Object Pascal with extensions to Delphi and extensions to FreePascal. In reaction to criticism, Free Pascal has adopted generics with the same syntax as Delphi, provided Delphi compatibility mode is selected, and both Delphi (partial) and Free Pascal (more extensive) support operator overloading. Delphi has also introduced many other features since version 7, including generics. Whereas FreePascal tries to be compatible to Delphi in Delphi compatibility mode, it also usually introduced many new features to the language that are not always available in Delphi.


References


External links


Introduction to Object Pascal
MacTech Vol 2 Issue 12 1985.

"The aim is to list which Pascal constructs are supported, and to show where the Free Pascal implementation differs from the Turbo Pascal or Delphi implementations."
Free Pascal: Reference guide
Reference guide for Free Pascal, version 2.0.0

* ttp://www.think-pascal.org/ Think Pascal 4.5Unofficial page about Symantec's final version of Think Pascal.


Delphi


Object Pascal Language Guide
Covering Borland Delphi 6-7
Delphi Basics
Resource of Delphi project source codes.
Delphi-Help - первая помощь программисту на DelphiDelphi Programming
Resource of Delphi Programming & Delphi Programming Forums. {{Wirth Borland CodeGear software Delphi (programming language) Object-oriented programming languages Pascal programming language family Programming languages created in 1986