What with Delphi Prism coming soon, I've been looking at Oxygene (the Remobjects compiler, Delphi Prism will use), and have a found a few features I'd love to see in Delphi Win32. S
views:
693answers:
11Simple answer: All of them. Simply because that would make it one language again.
ome of my favourites are :
Inline Property expressions and implicit property variables
property Length: double;
property Width: double;
property Area: double read Length*Width
Property Initial Values
property Length: Integer := 15;
Iterators
While Iterators are available in Delphi, the use of sequences and the yield keyword makes creating them much easier.
method GetEmptyKeys: sequence of string;iterator;
...
property EmptyKeys : sequence of TKey read GetEmptyKeys;
...
...
...
method TMyClass.GetEmptyKeys
begin
for each key in keylist do
if key = '' then
yield key;
end;
I could go on and on, but those would be very nice to have.
note this question has kind of been asked before but not in relation to Prism. here
Apart from what Gabr said, some of the syntactic sugar cubes I would really like to have in Win32 are:
- nullable types and related mechanisms like the colon operator and the coalesce compiler magic function
- class contracts, i.e. pre- and post-conditions and invariants
- require/allow variable on
with
statement, akausing
- multi-threading enhancements, like
async
andfuture
(ok, this is actually much more than just syntactic sugar)
Some things that would have prevented me running back to Oxygene/Prism screaming, everytime I had to use Delphi in the past 3 or 4 years:
- multi-pass compilation
- cut the forward declares and that mutual usages require you to put everything in one file
- type inference!
- using, named with, inline vars
- filenames are filenames, just filenames
- they should not be identifiers, and most certainly not namespaces
- make it crystal what gets compiled and what does not. This implicit search path stuff is very annoying, IMO.
- class libraries that don't require anything else to be referenced
- once referenced, no DCUs of units in the package should be necessary
I could go on on about actual language features. But some of them wouldn't even make sense in a single-pass compiler.
Or not a single language feature would come close to the benefits one of these general enhancements would bring to the table...
I think the followings can be implemented quickly for starters:
- try..except..finally block
- method keyword (function and procedure distinction doesn't make sense imho)
- require and ensure keywords
- string in case statements
- inline var
The colon operator looks wonderful. You have no idea how many times I've wished I had that in Delphi ever since I read about Oxygene having it. Same with double-comparisons, LINQ, try..except..finally and async/future declarations.
Put in features like this that would enhance the language, and leave out the slow, bloated "managed" crap that would wreck the fast, sleek, human-readable language I love, like multi-pass compilation, automatic garbage collection and inline variables, and I'd be very happy.
two pass compiler is number one!
The argument that speed will be slower doesn't hold water in reality.
Currently to have class A with at relationship to Class B without casting one declares the interface sections of these in a single unit.
With two pass you would not need to do that.
so you would have many smaller units with their dcus all ready compiled and only the unit you changed would need to be recompiled.
So 1 huge unit that vs many smaller units.
This is really a no brainer and with 64 bit coming why not do it right?