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.
- DevExpress offering Metro-inspired Tile control for Delphi VCL, plans to drop support for Delphi 7
- What next for Embarcadero Delphi? Roadmap with Mac, Linux support published.
- Oxygene for Java released: develop for Android and Java runtime with Delphi language in Visual Studio
- Prism: official Delphi language comes to Visual Studio
- Mobl: a new language for mobile applications, with Eclipse integration