Object Pascal

Object Pascal
Object Pascal
Paradigm(s) imperative, structured, object-oriented, functional (Delphi dialect only)
Appeared in 1986 (1986)
Designed by Apple, Niklaus Wirth, Anders Hejlsberg
Typing discipline static and dynamic (dynamic typing through Variants, array of const and RTTI), strong, safe
Major implementations Delphi (x86 and CLI), Oxygene (CLI), RemObjects Cooper (Java and Android), Free Pascal (x86, x86-64, PowerPC, ppc64, SPARC and ARM), Virtual Pascal (x86), TMT Pascal (x86), Turbo51 (Intel 8051)
Dialects Apple, Turbo Pascal, objfpc, Delphi, Delphi.NET, Oxygene
Influenced by Pascal, Smalltalk
Influenced C#, Java

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

Contents

Early history at Apple

Object Pascal is an extension of the Pascal language that was 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.

Apple dropped support for Object Pascal when they moved from Motorola 68K chips to IBM's PowerPC architecture in 1994.

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.

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 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 to 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.
  • .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 Morfik Pascal programming language developed by Morfik targets the 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 CE—as 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 also support for embedded (ARM).
  • 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, is available for producing code for Intel 8051 chips.
  • WDSibyl 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 archtectures.

  • 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), and the .NET 1.x, 2.0 (Delphi 8, Delphi 2005–Delphi 2007). 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 targets the .NET and Mono platforms.
  • 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 compiler’s 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.
  • TMT Pascal ?

Interpreters

Pascal Script (formerly known as InnerFuse) and 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.

Sample "Hello World" programs

Apple's Object Pascal

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

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.

program ObjectPascalExample;
 
   type
      PHelloWorld = ^THelloWorld;
      THelloWorld = object
         procedure Put;
      end;
 
   var
      HelloWorld: PHelloWorld; { this is a pointer to a THelloWorld }
 
   procedure THelloWorld.Put;
   begin
      WriteLn('Hello, World!');
   end;
 
begin
   New(HelloWorld);
   HelloWorld^.Put;
   Dispose(HelloWorld);
end.

Delphi and Free Pascal's Object Pascal

program ObjectPascalExample;
 
type
  THelloWorld = class
    procedure Put;
  end;
 
procedure THelloWorld.Put;
begin
  Writeln('Hello, World!');
end;
 
var
  HelloWorld: THelloWorld;               { this is an implicit pointer }
 
begin
  HelloWorld := THelloWorld.Create;      { constructor returns a pointer to an object of type THelloWorld }
  HelloWorld.Put;                        
  HelloWorld.Free;                       { this line deallocates the THelloWorld object pointed to by HelloWorld }
end.

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

Oxygene Object Pascal

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's Object Pascal

type
   THelloWorld = class
      procedure Put;            
      begin
         PrintLn('Hello, World!');
      end
   end;
 
var HelloWorld := THelloWorld.Create;
 
HelloWorld.Put;

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[3] including generics.

See also

References

External links


Wikimedia Foundation. 2010.

Игры ⚽ Поможем написать курсовую

Look at other dictionaries:

  • Object Pascal — Семантика: императивная Класс языка: мультипарадигмальный: императивный, структурный, объектно ориентированный, обобщённый[1], процедурный Тип исполнения: компилируемый …   Википедия

  • Object Pascal — (ou Pascal Objet en français) est un langage orienté objet dérivé du Pascal. Il a été créé en 1990 par la société Borland comme une amélioration de son logiciel phare de l époque, Turbo Pascal. Il s agissait alors de la version 5.5. Même si l… …   Wikipédia en Français

  • Object Pascal — es una evolución del lenguaje de programación Pascal, con inclusión de elementos pertenecientes al paradigma de la programación orientada a objetos …   Enciclopedia Universal

  • Object Pascal — Object Pascal,   Delphi …   Universal-Lexikon

  • Object Pascal — Delphi ist zum einen der Name einer vom Unternehmen Borland entwickelten objektorientierten Programmiersprache, die ursprünglich aus der von Niklaus Wirth erstellten Programmiersprache Pascal hervorgegangen ist, und zum anderen die Bezeichnung… …   Deutsch Wikipedia

  • Object Pascal — Este artículo o sección necesita ser wikificado con un formato acorde a las convenciones de estilo. Por favor, edítalo para que las cumpla. Mientras tanto, no elimines este aviso. También puedes ayudar wikificando otros artículos o cambiando este …   Wikipedia Español

  • Comparison of Object Pascal and C — Programming language comparisons General comparison Basic syntax Basic instructions Arrays Associative arrays String operations …   Wikipedia

  • Pascal (programming language) — Pascal Paradigm(s) imperative, structured Appeared in 1970 Designed by Niklaus Wirth Typing discipline static, strong, safe …   Wikipedia

  • Pascal (Programmiersprache) — Pascal Paradigmen: imperativ, strukturiert Erscheinungsjahr: 1972 Entwickler: Niklaus Wirth Typisierung: stark, statisch …   Deutsch Wikipedia

  • Object Windows Library — Developer(s) Originally Borland (now Codegear) Initial release 1991 Stable release OWLNext 6.30.9 / September 2, 2010; 14 months ago (2010 09 02) …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”