August 20, 2010

Delphi XE Beta Blogging: New in the RTL

In this third "beta blog" I'll just provide a (partial) list of new RTL classes and functions.

In this third "beta blog" I'll just provide a (partial) list of new RTL classes and functions. I've picked just half a dozen of new things in the RTL I find very useful, but the complete list accounts for several dozens of significant changes.

In case you don't know, "Delphi beta blogs" are authorized blog posts by independent bloggers covering features of a beta version of Delphi. This means I was given a specific permission to post about this topic and I'm discussing a feature of a pre-release version. Notice also that the official RAD Studio XE Preview page is at   http://www.embarcadero.com/rad-studio-xe-preview  . Since this is a pre-release, there is no guarantee it will work the same in the final version (or will actually be in the product).

Here is a partial list of  new classes in Delphi XE RTL (compared to Delphi 2010):

  • TBinaryReader and TBinaryWriter somewhat counterparts of the TTextReader and TTextWriter introduced in Delphi 2009
  • TTimeZone is a little helper for managing time zone and computing time differences
  • TInterlocked, TSpinWait, TSpinLock and many other new core synchronization classes help you push your multi-threaded code further and make it more cross-platform (as these classes have a native implementation, based on only core OS support). The TThread class has been also extended with direct execution of anonymous methods inside a temporary thread and several other features.
  • TRegEx is the core record implementing native regular expressions support. This is a big step forward, despite many developers already used third party libraries for regular expressions.

Other notable changes, beside new classes, include:

  • The addition of a DefaultEncoding to TStrings, which lets you pick for Unicode format when a list of strings to a text file. There is also support for converting string lists to and from arrays of strings.
  • The TPath record in IOUtils has a new GetHomePath class method, which on Windows returns the applications data folder, “AppData\Roaming”). The method calls a corresponding new function in SysUtils. There are actually a lot of improvements in file management, for example with the inclusion on TSymLink, and abstraction... all due to the coming cross platform support.
  • Finally, I'd like to mention one of the new functions, SplitStrings. This is quite fast, compared with other techniques I used in the past for splitting strings. Another small nice addition.

Again, this is a very partial and limited list of features, nothing revolutionary but many welcome additions.





 

4 Comments

Delphi XE Beta Blogging New in the RTL 

How has the regex engine been implemented? Linking to 
extenal C libraries (i.e. PCRE) or is it a pure 
Pascal library? If so which regex syntax does it 
support?
Comment by Luigi D. Sandon on August 20, 10:44

Delphi XE Beta Blogging New in the RTL 

@Luigi

My guess is that this is pure pascal, and it is using
Jan Goyvaerts regex implementation in RegexBuddy. Now,
when you use his TPerlRegex component in your own
applications, it relies on the PCRE C DLL, but
internally in the later versions of RegexBuddy, it
uses his own custom regular expression engine. He
posted that on his blog a while back...but I can't
seem to find it.

Anyhow, I don't have any inside knowledge, but that is
my guess.
Comment by Mick on August 20, 12:58

Delphi XE Beta Blogging New in the RTL 

Luigi,

  The regular expression library is based on existing 
open source work. AFAICT (this is still an unfinished 
product) it uses an external C library bound to the 
executable (no external DLL). I think is supports PERL 
regular expressions. I guess others (including the 
original author) could tell way more...

-Marco
Comment by Marco Cantu [http://www.marcocantu.com] on August 20, 13:03

RTL and Multithreading 

Speaking of multithreading, it could be a better idea to 
use OmniThreadLibrary instead of this low-level stuff, 
which looks like just class-level wrappers to existing 
functions. Sounds not very useful to me. Better bet on a 
good multithreaded architecture.
See http://otl.17slon.com
Comment by Arnaud [http://synopse.info] on September 2, 16:16


Post Your Comment

Click here for posting your feedback to this blog.

There are currently 0 pending (unapproved) messages.