A semi-proprietary programming language from Borland/Inprise (Basically, Pascal with Object extensions), it has all the advantages of C++ but none of its disadvantages.

it does, however, have all the disdvantages of pascal, which kind of outweighs the advantages of not having c++'s disadvantages

Fortunately, the real disadvantages are relatively easy to get around. The lack of pointer arithmetic and dynamic arrays can be hacked around using some ugly typedef-ish code and turning off range checking (unfortunately, that adds one of C++'s disadvantages back in), and TP et al have had an option to add in untyped references for quite some time, though there's no good reason to turn it off (since untyped references (aka void *s) are one of the hallmarks of why C and C++ suck).

I'd personally like a mix of Delphi (good object model) and C++ (good compilers). A simplified C++ which is actually object-oriented would be most appreciated. Unfortunately, the only real efforts in that regard have resulted in almost-but-not-quite languages such as Java.

(Wharfinger: I agree with you totally. That's part of why I stick to UNIX. I can't remember the last time I did any sort of unsafe typecast period. Oh, and I code exclusively in C++ now too, I just still like Delphi's object model better.)

It may be that "untyped references (a.k.a. void *s) are one of the hallmarks of why C and C++ suck", but Win32 programming is most of what ObjectPascal is used for, and you can't do Win32 programming without them. Really, they're everywhere, especially in anything involving a window. It's all about casting unsigned 32-bit ints to arbitrary pointer types. You can hide that stuff from the user (of the language, I mean), but the problem with that is that two of the greatest strengths of Delphi are (1) that you can get directly to the Win32 API, and (2) the VCL is written in ObjectPascal (and therefore extensible in the language you use it with; cf. Visual Basic), which couldn't have been done without (1).

That having been said, one of nicest things about C++ is that unless you have to interact with a primeval C API (e.g. Win32) unsafe typecasts can be avoided almost completely.

Unsafe typecasts are loathsome and ugly, but if you're willing to be paranoid and careful, you can live with them and even prosper. It's just nothing i ever choose to do if I can reasonably avoid it.

The bottom line is that there's no such thing as a "data type"; it's all just bytes in a row, zeroes and ones, and sometimes you have to face that fact if you want to get anything done.

As for ObjectPascal in general, it's a good language, but after learning C++ I'd just as soon not go back. Pascal in general just feels sort of stiff and inexpressive after writing a lot of C. YMMV, de gustibus non disputandem est, etc. . . .

This is the genealogy of the programming language Object Pascal:

Object Pascal is a child of Pascal.
Object Pascal was first known as Object Pascal in year 1985.
Then it begat Delphi in year 1995.

This genealogy is brought to you by the Programming Languages Genealogy Project. Please send comments to thbz.

The language of the Borland Delphi programming environment was called Object Pascal, until it got a name change in 2002 or so to just plain Delphi. It is the linear descendant of Borland Turbo Pascal. In fact, it is backwards compatible, and thus keeps a couple of misfeatures and flaws accumulated over the years in Pascal and Turbo Pascal.

Delphi's Object Pascal is a strongly typed compiled language that produces windows executables (and COM servers, DLLs, ActiveX controls, Control panel Applets etc.) and lately also x86 Linux binaries using Kylix.

It is a proprietry system with a single implementation from one vendor: Borland/Inprise.

“Object Pascal, a set of object-oriented extensions to standard Pascal, is the language of Delphi.” – Delphi help.

Of course, it also has many non-OO extensions over the primeval Pascal that Brian Kernighan disliked so much which make it a better, more rounded and complete language, and which effectively remove all the disadvantages of pascal

For instance, you can do the pointer arithmetic and type coercion that are occasionaly needed to interface with the operating system API or in the guts of a class. There are also dynamic arrays and other goodies that were not in the original Pascal.

One of nicest things about Object Pascal is that unless you have to interact with a primeval C API (e.g. Win32) unsafe typecasts can be avoided almost completely.

Seeing as Pascal is a purely procedural programming language, Object-Pascal supports both procedural and object-oriented programming styles, and the pragmatic grey area that uses both as needed.

Some of the constructs supported by Delphi 5 and later are:

Object-Pascal does not have any concept of operator overloading or templates.

Operator overloading I don’t miss. It is just syntactic sugar and has bitten me on occasion in C++. However as I code yet another list class, I occasionally find myself wanting templates.

Object-Pascal is not garbage-collected, for instance, a typical code fragment may read:

procedure UseStrings;
  lcStrings: TStringList; // an object var is actually a ptr to an instance, initially nil. 
  lcStrings := TStringList.Create; // assign the var to a new instance
  try // this also demonstrates the try.. finally block. It works like in Python

    // use the strings

  finally // like in Python, there is also a try..except block to catch exceptions
    lcStrings.Free; // manually release the created instance whatever happens

It is worth noting that the TComponent class and it's descendants (i.e. all the visual controls) have the concept of an Owner TComponent to which they can be attached and which will free them when it is freed. This is why you can iterate through the child controls of a form or panel, and why controls on forms laid out in the IDE do not require manual freeing.

See also Why pascal is not my favorite programming language and Why pascal sucks These talk of the disadvantages of standard Pascal, almost all of which have been fixed by Object Pascal. That is, Object Pascal does not share many of the disadvanages of pascal.

See also Differences between C and Borland Delphi and When to use a semicolon in Pascal.

With regards to sdd's comment that Some critics do not even consider Delphi to be a real programming language, as it is a RAD system or visual programming language, hiding most of pascal under menus

My opinion is that Delphi is not a programming language, it is a RAD suite that includes a programming language (Borland's version of Object Pascal).

This language is very real, to the extent that if you really want to to, you can generate all the source files yourself using a text editor, invoke a commandline compiler called dcc.exe upon them, which will produce an executable. You can make DLL libraries, GUI or commandline apps this way. I should know, I've done it.

The fact that you have aditional tools does not detract from the realness of the compiler for anyone except the terminally superficial.

In fact, one of the tenets of delphi is that anything that can be done visually can be done in code. In general, the visual tools are Delphi code.

Object Pascal was created in 1985 by Apple computer in cooperation with Niklaus Wirth. Apple released their Object Pascal in 1986, and Borland Turbo Pascal 5.5 with objects was not relaesed until 1989. Delphi wasn't released until 1995, ten years after the creation of Object Pascal. Some deluded critics do not even consider Delphi to be a real programming language, as it is a RAD system or visual programming language, hiding most of pascal under menus.

Borland also isn't the only company producing a pascal compiler. Other compilers include Compaq Pascal, Prospero Pascal, THINK pascal (Mac), Metrowerks CodeWarrior, and several free pascal compilers. Unfortunately, since Object Pascal was never standardized, each of these implements fixes to pascal's flaws (enumerated by Kernighan) in different ways.


1974 Pascal: User Manual and Report by Niklaus Wirth and Kahtleen Jensen< br> 1977 pascal standardizing started
1979 ISO committee formed
1980 extended pascal committee formed
1981 Why Pascal is not my Favorite Language by Kernighan
1983 Unextended pascal: published ANSI/IEEE770X3.97-1983 / ISO 7185
1983 extended pascal: 12 candidate extensions published
1985 Object Pascal: Apple worked on (released in 86)
1986 extended pascal draft
1989 unextended pascal ISO vs. ANSI issues resolved
1989 Turbo Pascal 5.5 with Objects
1989 extended pascal standard
1991 extended pascal final standard
1992 (last version) Turbo Pascal 7
1995 Delphi

brief summary of differences:

1983 ISO 7185 unextended pascal (included goto)
ISO 7185 : 1983 (added conformant array)
differences resolved 1989
ISO 7185 : 1990 final standard
1989 ISO 10206 extended pascal (final 1991) ANSI/IEEE 770X3.160-1989.
import and external linkage
short circuit or_else and_then
value initalized data,
shemata: type families
string types: unify fixed and variable strings
constant expressions
functions may return structures
object pascal -- no official standard ever released
1993 draft report
extension of type system
type coercion

Here's a few features and how each compiler implemented them. This information was extremely difficult to find without having the manuals, so if you know more detail, please let me know so I can add it! (x indicates it is implemented as shown in the first column.)

                compaq   codewarrior   turbo  delphi       Sun Workshop Pascal 
  otherwise        ?          ?         else    else             x
  return           x          x           ?       x              x 
  continue,break   x      cycle,leave     x       x           next,exit
  type casting     ::     mytype(myvar)   ?  mytype(myvar)       ?
If you can help fill in the ?'s above, please /msg me!!


http://pascal-central.com/ooe-stds.html (1993 draft report)
timeline partly from http://www.pascal-central.com/extpascal.html

Log in or register to write something here or to contact authors.