Delphi Prism - new language features for Delphi .NET developers
Delphi Prism brings a lot of new language features for .NET development, you will see a much more .NET language friendly and more dynamic language, at the same time language features you won't see in other .NET languages.
This post starts to show some new features on the Delphi Prism language.
You always use procedure and function words to declare a method, in Delphi Prism you can continue using, but now you have this new syntax.
type
ConsoleApp = class
public
class method Main;
method loopsTesting; // This is a procedure
method fillData : sequence of Country; // This is a function
var
Countries : sequence of Country;
end;
Query Expressions
Based upon its sequence type, Delphi Prism provides a powerful syntax for working on sequences in a syntax similar to SQL. Query Expressions enable you to perform actions such as filtering, sorting, partitioning and joining of data in sequences in an intuitive way, and providing full compile-time type checking and Intellisense. Much like sequences themselves, Query Expressions can be backed by in-memory data or information from remote sources.
Actions performed through query statements might be either performed locally on in memory data, or be processed on the data back-end before data is actually transferred.For example, sorting a sequence using the "order by" clause will work seamlessly, for an "array of String" or for a database table containing millions of records. In the case of the array, the sorting will happen on the local system, but for the data table, the back-end SQL database can handle the sorting as part of the data retrieval. The same concepts would apply to filtering ("where" clause) and other operations.
Look the example:
Class definition
type Customer = public class
property FirstName: String;
property LastName: String;
property Age: Integer;
property Street: String;
property City: String;
property Country: String;
property DateOfBirth: DateTime;
property Orders: sequence of Order;
end;
Order = public class
property OrderID: String;
property OrderDate: DateTime;
property Total: Double;
end;
Would you like to know more about the new Delphi Prism Language, visit Delphi Prism Wiki - language section
This post starts to show some new features on the Delphi Prism language.
You always use procedure and function words to declare a method, in Delphi Prism you can continue using, but now you have this new syntax.
type
ConsoleApp = class
public
class method Main;
method loopsTesting; // This is a procedure
method fillData : sequence of Country; // This is a function
var
Countries : sequence of Country;
end;
Query Expressions
Based upon its sequence type, Delphi Prism provides a powerful syntax for working on sequences in a syntax similar to SQL. Query Expressions enable you to perform actions such as filtering, sorting, partitioning and joining of data in sequences in an intuitive way, and providing full compile-time type checking and Intellisense. Much like sequences themselves, Query Expressions can be backed by in-memory data or information from remote sources.
Actions performed through query statements might be either performed locally on in memory data, or be processed on the data back-end before data is actually transferred.For example, sorting a sequence using the "order by" clause will work seamlessly, for an "array of String" or for a database table containing millions of records. In the case of the array, the sorting will happen on the local system, but for the data table, the back-end SQL database can handle the sorting as part of the data retrieval. The same concepts would apply to filtering ("where" clause) and other operations.
Look the example:
Class definition
type Customer = public class
property FirstName: String;
property LastName: String;
property Age: Integer;
property Street: String;
property City: String;
property Country: String;
property DateOfBirth: DateTime;
property Orders: sequence of Order;
end;
Order = public class
property OrderID: String;
property OrderDate: DateTime;
property Total: Double;
end;
- Returning all Customers with more them 30 years old
for each from c in Customers where c.Age > 30 do
...
- Returning all Customer with more them 30 years old and add First Name and Last Name to the variable n
for each from c in Customers where c.Age > 30 select c.FirstName+' '+c.LastName into n do
...
Would you like to know more about the new Delphi Prism Language, visit Delphi Prism Wiki - language section

Andreano, Could you please fix the formatting in the above code?, it didn't' looks good in FF3