You are on page 1of 6

Object Pascal

From Wikipedia, the free encyclopedia

(Redirected from Delphi (programming language)) Object Pascal refers to a branch of object-oriented derivatives of Pascal, mostly known as the primary programming language of Embarcadero Delphi.

Object Pascal
Paradigm(s) Imperative, Structured, Objectoriented, Functional (Delphi dialect only), Component-based, Event-driven, Generic 1986 Apple, Niklaus Wirth, Anders Hejlsberg

Contents
Appeared in

1 Early history at Apple 2 The Borland and CodeGear years 3 Versions 4 Compilers 4.1 Legacy products 5 Interpreters 6 Sample "Hello World" programs 6.1 Apple's Object Pascal 6.2 Turbo Pascal's Object Pascal 6.3 Delphi and Free Pascal's Object Pascal 6.4 Oxygene Object Pascal 6.5 DWScript's Object Pascal (aka Smart Pascal) 7 Development 8 See also 9 References 10 External links

Designed by

Typing discipline static and dynamic (dynamic typing through Variants, array of const and RTTI), strong, safe Delphi (x86, ARM, iOS and Major implementations CLI), Oxygene (CLI, Java, Android, Cocoa), Free Pascal (x86, x86-64, PowerPC, ppc64, SPARC and ARM), Virtual Pascal (x86), Turbo51 (Intel 8051) Dialects Influenced by Apple, Turbo Pascal, objfpc, Delphi, Delphi.NET, Oxygene Pascal, Smalltalk C#, Java, GML
. p ,. p p ,. p a s

Early history at Apple

Influenced Usual filename

Object Pascal is an extension of the Pascal language that was extensions developed at Apple Computer 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 called Clascal, which was available on the Lisa computer. Object Pascal was needed in order to support MacApp, an expandable Macintosh application framework that would now be called a class library. Object Pascal extensions and MacApp itself 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 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 tight integration of its tools. The development stopped after the 4.01 version because the company was bought by Symantec. The developers then left the project. Apple dropped support for Object Pascal when they moved from Motorola 68K chips to IBM's PowerPC architecture in 1994. MacApp 3.0, for this platform, was re-written in C++.

The Borland and CodeGear years

In 1986, Borland introduced similar extensions, also called 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 in 1994, they created a successor to Turbo Pascal, called 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 c l a s sin preference to o b j e c t , the Create constructor and a virtual Destroy destructor (and negating having to call the N e wand D i s p o s eprocedures), 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 and anonymous methods.

Versions
Borland used the name Object Pascal for the programming language in the first versions of Delphi, but later renamed it to the Delphi programming language. However, compilers that claim to be compatible with Object Pascal are often trying to be compatible with Delphi source code.[citation needed ] Because Delphi is trademarked, compatible compilers continued using the name Object Pascal. Embarcadero Technologies, which purchased Delphi in 2008,[1] sells the Delphi IDE that compiles the Delphi dialect of Object Pascal to Windows and Mac OS X. .NET support existed from Delphi 8 through Delphi 2005, Delphi 2006 and Delphi 2007, which now has been replaced by another language, Oxygene (see below), which is not fully backward-compatible. The Oxygene programming language developed by RemObjects Software targets the Common Language Infrastructure and the Java (software platform) Runtime Environment. The Morfik Pascal programming language developed by Morfik targets Ajax-enabled Web applications. The Morfik compiler is incorporated into the company's AppsBuilder IDE and allows Object Pascal code to be used in implementing code that will execute both in the browser and on the server. It uses the Free Pascal compiler to generate native binaries from Object Pascal. The open source Free Pascal project allows the language to be compiled for a wide range of operating systems including Linux (32-bit and 64-bit), FreeBSD, Mac OS/Mac OS X, Solaris, Win32, Win64 and Windows CEas well as for several different hardware architectures. The first version of Free Pascal for the iPhone SDK 2.x was announced on January 17, 2009.[2] Now there is support for the ARM ISA also. The Smart Pascal programming language [3] targets JavaScript/ECMAScript, and is used in Smart Mobile Studio by Optimale Systemer to target web browsers (HTML5), servers (node.js) and desktop (node-webkit) applications. Smart Pascal is based on the DWScript language with extensions 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. MIDletPascal is aimed at the Java byte-code platform. The open source GNU Pascal compiler is available as a front-end to the GNU compiler collection, which implements the ISO 7185 Pascal standard, and "most" of the ISO 10206 Extended Pascal standard. Also, a free compiler, Turbo51 (http://turbo51.com), is available for producing code for Intel 8051 chips.

WDSibyl (http://www.wdsibyl.org) is an open source Delphi-like IDE and compiler available for Microsoft Windows and OS/2, and is a commercial Borland Pascal compatible environment released by a company called Speedsoft that was later developed into a Delphi like RAD environment called 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 compilers are available for a wide range of operating systems and architectures.

Embarcadero Delphi (formerly CodeGear Delphi and Borland Delphi) is probably the best known compiler. It is the successor of the highly successful Borland Pascal and Turbo Pascal product line. It targets Win16 (Delphi 1), Win32 (Delphi 2 and later), Windows 64-bit (Delphi XE2 and later), the .NET 1.x, 2.0 (Delphi 8, Delphi 2005Delphi 2007) and Mac OS X (Delphi XE2 and later), iOS (Delphi XE2 and later, generating native binaries in XE4 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 those of Turbo Pascal 7 and Delphi, among others. Currently, FPC can generate code for x86, x86-64, PowerPC, SPARC, and ARM processors, and for various operating systems, including Microsoft Windows, Linux, FreeBSD, Mac OS and Mac OS X (with an Xcode integration kit). Several separate projects exist to facilitate rapid application development with FPC, the most prominent one being the Lazarus IDE. GNU Pascal (A separately distributed part of the GNU Compiler Collection) While not formally aimed at the Delphi dialect of Pascal, it does contain a Borland 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 noteworthy as having prolific support for operating systems and hardware architectures. Oxygene (formerly known as Chrome) is an Object Pascal compiler from RemObjects Software that integrates into Microsoft Visual Studio. It is also available as free command-line compiler that runs native on CLI. It is 3 compilers in one, each targeting a different platform: Echoes for .NET/Mono/WinRT/Windows Phone 8, Cooper for Java & Android and Nougat for iOS & OS X. MIDletPascal is a mobile application development tool that generates Java ME bytecode. PocketStudio is a Pascal based IDE for Palm OS.

Legacy products
Borland Kylix was a Linux 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 was a free 32-bit Turbo Pascal- and Delphi-compatible compiler aimed mainly at OS/2 and Microsoft Windows, although it also developed a DOS+ Extender and an experimental Linux cross-compiler. The compilers development stopped at about the level of Delphi 2. In 2007, with its official website ceasing to operate, Virtual Pascal was discontinued from being further developed.

Interpreters
Main article: Pascal Script Pascal Script (http://www.remobjects.com/ps) (formerly known as InnerFuse) and DWScript (http://code.google.com/p/dwscript/) (Delphi Web Script) are open-source Object Pascal interpreters/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.

Sample "Hello World" programs


Apple's Object Pascal

p r o g r a mO b j e c t P a s c a l E x a m p l e ; t y p e T H e l l o W o r l d=o b j e c t p r o c e d u r eP u t ; e n d ; v a r H e l l o W o r l d :T H e l l o W o r l d ; p r o c e d u r eT H e l l o W o r l d . P u t ; b e g i n W r i t e L n ( ' H e l l o ,W o r l d ! ' ) ; e n d ; b e g i n N e w ( H e l l o W o r l d ) ; H e l l o W o r l d . P u t ; D i s p o s e ( H e l l o W o r l d ) ; e n d .

Turbo Pascal's Object Pascal


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.
p r o g r a mO b j e c t P a s c a l E x a m p l e ; t y p e P H e l l o W o r l d=^ T H e l l o W o r l d ; T H e l l o W o r l d=o b j e c t p r o c e d u r eP u t ; e n d ; v a r H e l l o W o r l d :P H e l l o W o r l d ;{t h i si sap o i n t e rt oaT H e l l o W o r l d} p r o c e d u r eT H e l l o W o r l d . P u t ; b e g i n W r i t e L n ( ' H e l l o ,W o r l d ! ' ) ; e n d ; b e g i n N e w ( H e l l o W o r l d ) ; H e l l o W o r l d ^ . P u t ; D i s p o s e ( H e l l o W o r l d ) ; e n d .

Delphi and Free Pascal's Object Pascal


p r o g r a mO b j e c t P a s c a l E x a m p l e ; t y p e T H e l l o W o r l d=c l a s s p r o c e d u r eP u t ; e n d ; p r o c e d u r eT H e l l o W o r l d . P u t ; b e g i n W r i t e l n ( ' H e l l o ,W o r l d ! ' ) ; e n d ; v a r H e l l o W o r l d :T H e l l o W o r l d ; b e g i n H e l l o W o r l d: =T H e l l o W o r l d . C r e a t e ; H e l l o W o r l d . P u t ; H e l l o W o r l d . F r e e ; e n d . {t h i si sa ni m p l i c i tp o i n t e r}

{c o n s t r u c t o rr e t u r n sap o i n t e rt oa no b j e c to ft y p eT H e l l o W o r l d}

{t h i sl i n ed e a l l o c a t e st h eT H e l l o W o r l do b j e c tp o i n t e dt ob yH e l l o

Note that the object construct is still available in Delphi and Free Pascal (Delphi-compatible mode).

Oxygene Object Pascal


n a m e s p a c eO b j e c t P a s c a l E x a m p l e ; i n t e r f a c e t y p e C o n s o l e A p p=c l a s s c l a s sm e t h o dM a i n ; e n d ; T H e l l o W o r l d=c l a s s m e t h o dP u t ; e n d ; i m p l e m e n t a t i o n m e t h o dT H e l l o W o r l d . P u t ; b e g i n C o n s o l e . W r i t e L i n e ( ' H e l l o ,W o r l d ! ' ) ; e n d ; c l a s sm e t h o dC o n s o l e A p p . M a i n ; b e g i n v a rH e l l o W o r l d: =n e wT H e l l o W o r l d ; H e l l o W o r l d . P u t ; e n d ; e n d .

DWScript's Object Pascal (aka Smart Pascal)


t y p e T H e l l o W o r l d=c l a s s p r o c e d u r eP u t ; b e g i n P r i n t L n ( ' H e l l o ,W o r l d ! ' ) ; e n d e n d ; v a rH e l l o W o r l d: =T H e l l o W o r l d . C r e a t e ; H e l l o W o r l d . P u t ;

Note that 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, now also by Free Pascal. In reaction to criticisms, Free Pascal has adopted generics, and both Delphi and Free Pascal now support operator overloading (with different grammar, though). Delphi has also introduced many other features since version 7[4] including generics.

See also
Borland Kylix Comparison of programming languages Free Pascal Turbo51 Hello world program

References

1. ^ Community Letter: Embarcadero Technologies agrees to acquire CodeGear from Borland (http://edn.embarcadero.com/article/38132). Edn.embarcadero.com. Retrieved on 2013-07-21. 2. ^ "iPhone/iPod development" (http://wiki.freepascal.org/iPhone/iPod_development). Free Pascal development team. Retrieved 2009-04-13. 3. ^ "A Smart Book" (https://leanpub.com/asmartbook). 4. ^ "New Delphi language features since Delphi 7" (http://dn.codegear.com/article/34324). CodeGear. Retrieved 2008-07-06.

External links
Delphi Basics (http://www.delphibasics.info), Resource of Delphi Project Source Codes. Introduction to Object Pascal (http://www.mactech.com/articles/mactech/Vol.02/02.12/ObjectPascal/), MacTech Vol 2 Issue 12 1985. Object Pascal reference guide for Free Pascal. (http://www.freepascal.org/docs-html/ref/ref.html) "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." Object Pascal reference guide for Free Pascal, downloadable PDF (http://www.freepascal.org/docs/ref.pdf) Delphi-Help - Delphi (http://delphi-help.ru/) Major Differences Between the Syntax of C++ and Object Pascal (http://www.roblocher.com/whitepapers/opascal.aspx) Retrieved from "http://en.wikipedia.org/w/index.php?title=Object_Pascal&oldid=571628530" Categories: Pascal programming language family Delphi programming language Object-oriented programming languages CodeGear software Borland Programming languages created in 1986 This page was last modified on 5 September 2013 at 11:04. Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.

You might also like