Quantcast
Channel: Delphi Programming – The curse of Dennis D. Spreen
Viewing all articles
Browse latest Browse all 19

Delphi Prism new language features

$
0
0

Andreano Lanusse wrote about the new Delphi Prism language features compared to Delphi Win32.

Some of them I really would like to see in Delphi Win32 and some I don’t like and disallowed it in our internal code creation rules. The most important I dislike is

“Variable everywhere and create a instance at the same time you declare.”

var
  path : String := System.IO.Path.GetFullPath(tbDatabase.Text);
  db : DataContext := new DataContext(path);
begin
  var i : Integer := 0;
  var contacts := from contact in db.GetTable<Contact>() select contact;
end.

Looks awkful to me (like VB). This is the code written by our long term code creation rules:

var
  Path: String;
  Db: DataContext;
  I: Integer := 0;
begin
  Path := System.IO.Path.GetFullPath(tbDatabase.Text);
  Db := new DataContext(Path);
  Contacts := from contact in db.GetTable<Contact>() select contact;
end;

I like the separation from var declaration and code.


Viewing all articles
Browse latest Browse all 19

Trending Articles