Delphi developers should note changes in the Delphi language coming as a result of the move towards the LLVM compiler for mobile support. Embarcadero has released a paper describing these in detail. The just-released RAD Studio XE4 includes the ARM compiler for iOS, with an Android compiler to follow later this year.
It seems to me that Delphi developers will now fall into two broad camps:
1. Windows VCL developers for whom the new FireMonkey cross-platform framework is of little interest, either because they are not developing for Mac or mobile, or because they prefer other tools for those platforms.
2. Developers who are embracing the new platform targets, migrating code to FireMonkey or starting new projects there, and planning to share code across all platforms as far as possible.
If you are in the first camp, you need not worry too much about language changes yet. I believe it is Embarcadero’s long-term intention to unify Delphi’s compilers around LLVM on all platforms, but when or whether this will happen for Win32 and Win64 is moot; my guess is that what the company now calls the “classic compiler” will be around for a long time yet. However the Mac compiler may migrate to LLVM sooner. (I am speculating).
Currently, RAD Studio XE4 includes five compilers:
- The Win32 compiler (DCC32)
- The Win64 compiler (DCC64)
- The Mac compiler (DCCOSX)
- The iOS Simulator compiler (DCCIOS32)
- The iOS ARM compiler (DCCIOSARM)
Of these, only the last one currently uses LLVM, though the iOS Simulator compiler behaves as closely as possible like its ARM cousin. In general the language changes are currently only applicable by default for the LLVM and Simulator compilers as far as I can tell.
What are the language changes? My quick summary of the biggest changes is as follows:
- One string type only: UTF16, reference counted, immutable (though this is a point of confusion; reading the paper it seems it is not yet immutable as it describes modifying in place, but may become so).
- 0-based strings. There is a compiler directive $ZEROBASEDSTRINGS, which is off for Delphi XE3 and Delphi XE4, but on for the mobile compiler in XE4.
- Automatic reference counting. Objects are destroyed automatically when the reference count hits zero. MyObj.Free; does not destroy the object, only reduces the reference count (and destroys it if zero). You can create weak references (which do not increment the count) by using the [Weak] attribute. If you really want to destroy the object, use MyObj.DisposeOf;.
In addition, the With statement is now deprecated.
The language changes are described in detail in the paper The Delphi Language for Mobile Development, which you can find here.
Tim – Good blog post and thanks for helping inform developers about the continued innovations that we are adding to the Delphi language to keep it modern and forward looking.
A small note: RAD Studio XE4 actually has 8 compilers. While Delphi XE4 includes 5 compilers (more for you money I always say), RAD Studio XE4 also includes 3 C++ compilers: BCC32, BCC64, and BCCOSX 🙂
As a compiler, programming languages and frameworks fanatic, it is great to see Delphi and C++ moving forward. We have moved far beyond the original Pascal and C languages to meet the demands of developers and the capability of the ever changing hardware, operating system and platforms that we leverage for our users.
We can debate what languages to use, what languages are popular or modern, it is always great to see programming (software engineering) moving forward.
Back in 1968, Edsger Dijkstra published his famous (and some would say controversial) article in Communications of the ACM, “A case against the GO TO Statement” – http://www.cs.utexas.edu/~EWD/ewd02xx/EWD215.PDF
Delphi/Pascal developers have been discussing the “with” statement for years. With the “Delphi Language for Mobile” white paper you mention, we have taken a first step by adding the “deprecated” directive in the Delphi for iOS compiler. Let the discussions about “with” continue 🙂
I celebrate developers every day. We will continue to move forward at Embarcadero. Come along for the ride!
Sincerely,
David Intersimone “David I”
VP of Developer Relations and Chief Evangelist
Embarcadero Technologies