Language Features

What language feature would you most like to see implemented in upcoming versions of Delphi?

My language feature request is...

You've used all your votes and won't be able to post a new idea, but you can still search and comment on existing ideas.

There are two ways to get more votes:

  • When an admin closes an idea you've voted on, you'll get your votes back from that idea.
  • You can remove your votes from an open idea you support.
  • To see ideas you have already voted on, select the "My feedback" filter and select "My open ideas".
(thinking…)

Enter your idea and we'll search to see if someone has already suggested it.

If a similar idea already exists, you can support and comment on it.

If it doesn't exist, you can post your idea so others can support it.

Enter your idea and we'll search to see if someone has already suggested it.

  1. modern code generation

    Support for better optimization, SSE , SSE2 , autoparallelization,etc....

    315 votes
    Vote
    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      You have left! (?) (thinking…)
      under review  ·  2 comments  ·  Flag idea as inappropriate…  ·  Admin →
    • 203 votes
      Vote
      Sign in
      Check!
      (thinking…)
      Reset
      or sign in with
      • facebook
      • google
        Password icon
        I agree to the terms of service
        Signed in as (Sign out)
        You have left! (?) (thinking…)
        0 comments  ·  Flag idea as inappropriate…  ·  Admin →
      • allow initialization expression in var block of function/procedure

        Allow construction like:
        procedure Test();
        var
        p: Pointer = nil; <--
        begin
        end;

        It's supported on the unit level. Very strange why this doesnt be allowed inside function/procedure.

        165 votes
        Vote
        Sign in
        Check!
        (thinking…)
        Reset
        or sign in with
        • facebook
        • google
          Password icon
          I agree to the terms of service
          Signed in as (Sign out)
          You have left! (?) (thinking…)
          1 comment  ·  Flag idea as inappropriate…  ·  Admin →
        • Pure Interface

          Main problem with delphi interface: can't mix interfaces with objects.
          There are also problems like: access violation when using it, perfomance problem, additional field for ref counter, bad look guid in source.

          If Delphi have got Pure interface or availabity to add abstract classes as secend, third,... inherited class all those problems should be resolved

          108 votes
          Vote
          Sign in
          Check!
          (thinking…)
          Reset
          or sign in with
          • facebook
          • google
            Password icon
            I agree to the terms of service
            Signed in as (Sign out)
            You have left! (?) (thinking…)
            0 comments  ·  Flag idea as inappropriate…  ·  Admin →
          • 55 votes
            Vote
            Sign in
            Check!
            (thinking…)
            Reset
            or sign in with
            • facebook
            • google
              Password icon
              I agree to the terms of service
              Signed in as (Sign out)
              You have left! (?) (thinking…)
              5 comments  ·  Flag idea as inappropriate…  ·  Admin →
            • Nilable types

              Nilable types like the Nullable types in C# 2.0.
              I don't like the Variant since it allows a lot more than int/null values t be written in a int?

              47 votes
              Vote
              Sign in
              Check!
              (thinking…)
              Reset
              or sign in with
              • facebook
              • google
                Password icon
                I agree to the terms of service
                Signed in as (Sign out)
                You have left! (?) (thinking…)
                2 comments  ·  Flag idea as inappropriate…  ·  Admin →
              • allow destructor for records

                It would be useful if records have automatically called destructor. Very strange why this is not supported. Because of, if record contains managed fields Delphi compiler generates something like destructor.

                45 votes
                Vote
                Sign in
                Check!
                (thinking…)
                Reset
                or sign in with
                • facebook
                • google
                  Password icon
                  I agree to the terms of service
                  Signed in as (Sign out)
                  You have left! (?) (thinking…)
                  0 comments  ·  Flag idea as inappropriate…  ·  Admin →
                • "class helper" for interfaces

                  It is possible to add utility functions to a class namespace. This is very handy because no other namespace is polluted and the instance to the class doesn't have to be passed explicitly.

                  I wish to have the same for interfaces:

                  TMyInterfaceHelper = interface helper for IMyInterface
                  procedure MyAddedProcedure;
                  end;

                  It is even more interesting because Interfaces can be implemented by more than one class.

                  It makes it possible to define very thin easy maintainable interfaces. All convenience functions would be in "external" interface helpers but easily accessible if needed.

                  44 votes
                  Vote
                  Sign in
                  Check!
                  (thinking…)
                  Reset
                  or sign in with
                  • facebook
                  • google
                    Password icon
                    I agree to the terms of service
                    Signed in as (Sign out)
                    You have left! (?) (thinking…)
                    2 comments  ·  Flag idea as inappropriate…  ·  Admin →
                  • Multiple Inheritance support for Interfaces in native Delphi

                    Objects can implement multiple interfaces but interfaces can only have one ancestor. Why can't Interfaces descend from more than one ancestor? This is a feature both C# and Java support. Delphi for .NET added support for multiple interface inheritance back in 2003 but this was never added to native Delphi.

                    If an implementing object needs to implement multiple interface contracts there is no way to enforce this at compile time. If Delphi supported multiple interface inheritance you could define a single interface that inherits from two or more parents and forces implementations to implement all parents.

                    An example of this…

                    28 votes
                    Vote
                    Sign in
                    Check!
                    (thinking…)
                    Reset
                    or sign in with
                    • facebook
                    • google
                      Password icon
                      I agree to the terms of service
                      Signed in as (Sign out)
                      You have left! (?) (thinking…)
                      1 comment  ·  Flag idea as inappropriate…  ·  Admin →
                    • Block-scoped variables à la C#'s using-statement, e.g. by extending the with-statement

                      I would really love to see some way to have block-scoped variables. If these are of a reference-counted type such as interface references the reference count should automatically be released at the end of the block. I would personally suggest implementing this as an extension of the with-statement, e.g.

                      with lSomeVar: ISomeInterface = GetSomeInterface do
                      // ideally we get type-inference too and could thus make the variable type optional in the above statement
                      begin
                      DoStuffTo(lSomeVar);
                      end; // <- release reference count on lSomeVar here
                      // outside of this block usage of the lSomeVar-symbol should be invalid

                      This would also reduce…

                      25 votes
                      Vote
                      Sign in
                      Check!
                      (thinking…)
                      Reset
                      or sign in with
                      • facebook
                      • google
                        Password icon
                        I agree to the terms of service
                        Signed in as (Sign out)
                        You have left! (?) (thinking…)
                        3 comments  ·  Flag idea as inappropriate…  ·  Admin →
                      • Operator Overloading for classes

                        Now it is possible to overload operators for records:

                        type
                        TMyRecord = record
                        class operator Add(a, b: TMyRecord): TMyRecord; // Addition of two operands of type TMyRecord
                        class operator Subtract(a, b: TMyRecord): TMyRecord; // Subtraction of type TMyRecord
                        class operator Implicit(a: Integer): TMyRecord; // Implicit conversion of an Integer to type TMyRecord
                        class operator Implicit(a: TMyRecord): Integer; // Implicit conversion of TMyRecordto Integer
                        class operator Explicit(a: Double): TMyRecord; // Explicit conversion of a Double to TMyRecord
                        end;

                        It will be great if you add operator overloading for classes!!!

                        24 votes
                        Vote
                        Sign in
                        Check!
                        (thinking…)
                        Reset
                        or sign in with
                        • facebook
                        • google
                          Password icon
                          I agree to the terms of service
                          Signed in as (Sign out)
                          You have left! (?) (thinking…)
                          3 comments  ·  Flag idea as inappropriate…  ·  Admin →
                        • Inline variable declaration and type inference

                          preferably with block scope.

                          eg:

                          procedure Myproc;
                          begin
                          ....some code
                          var x := TStringList.Create; //compiler infers type of x based on what is being assigned to it.
                          x.add("hello world");
                          ...
                          x.free;

                          //with block scope

                          procedure Myproc;
                          begin
                          ....some code
                          if true then
                          begin
                          var x := TStringList.Create; //x only available in this block
                          x.add("hello world");
                          ...
                          end;
                          x.add("sdfs"); //compiler error identifier x does not exist!

                          16 votes
                          Vote
                          Sign in
                          Check!
                          (thinking…)
                          Reset
                          or sign in with
                          • facebook
                          • google
                            Password icon
                            I agree to the terms of service
                            Signed in as (Sign out)
                            You have left! (?) (thinking…)
                            0 comments  ·  Flag idea as inappropriate…  ·  Admin →
                          • Add Constraints in Generics for primitive types

                            Please make possible to add contraints in generics for simple data types.

                            Possible today:
                            class operator Implicit(const Value: Nullable<T>): Nullable<Extended>;

                            NOT possible:
                            class operator Implicit(const Value: Nullable<T: Integer>): Nullable<Extended>;

                            14 votes
                            Vote
                            Sign in
                            Check!
                            (thinking…)
                            Reset
                            or sign in with
                            • facebook
                            • google
                              Password icon
                              I agree to the terms of service
                              Signed in as (Sign out)
                              You have left! (?) (thinking…)
                              1 comment  ·  Flag idea as inappropriate…  ·  Admin →
                            • Attributes with named parameters

                              Since attributes will be present in Delphi 2010, I would like to request support for named parameters like the sample below

                              [TPerson(Name='Gad D Lord', Age=30)]

                              which is quite more meaningful than the

                              [TPerson('Gad D Lord', 30)].

                              Supporting this will allow
                              1. Beter portability from C#
                              2. Ability to specify only several parameters and the others to be defaulted
                              3. Ability to change the order in which parameters are passed
                              4. Have greater readability

                              14 votes
                              Vote
                              Sign in
                              Check!
                              (thinking…)
                              Reset
                              or sign in with
                              • facebook
                              • google
                                Password icon
                                I agree to the terms of service
                                Signed in as (Sign out)
                                You have left! (?) (thinking…)
                                0 comments  ·  Flag idea as inappropriate…  ·  Admin →
                              • Shortcut property declarations

                                remove the requirement for a getter/setter.

                                property AProperty : string;

                                rather than

                                property AProperty : string read FProperty write FProperty;

                                in this case FProperty is redundant.

                                13 votes
                                Vote
                                Sign in
                                Check!
                                (thinking…)
                                Reset
                                or sign in with
                                • facebook
                                • google
                                  Password icon
                                  I agree to the terms of service
                                  Signed in as (Sign out)
                                  You have left! (?) (thinking…)
                                  1 comment  ·  Flag idea as inappropriate…  ·  Admin →
                                • [TWebMethod]

                                  Since attributes will be part of D2010, shall we see one of my favourite attributes in use TWebMethod (similar to the WebMethod in .NET)?

                                  I really hope writing web services to be come as easy as in the .NET world.

                                  13 votes
                                  Vote
                                  Sign in
                                  Check!
                                  (thinking…)
                                  Reset
                                  or sign in with
                                  • facebook
                                  • google
                                    Password icon
                                    I agree to the terms of service
                                    Signed in as (Sign out)
                                    You have left! (?) (thinking…)
                                    0 comments  ·  Flag idea as inappropriate…  ·  Admin →
                                  • Interfaces with events and properties

                                    Please plan having Interfaces support properties and event declarations.
                                    Such feature is already present in .NET and I don't see any obstacle in having the same in Delphi.

                                    13 votes
                                    Vote
                                    Sign in
                                    Check!
                                    (thinking…)
                                    Reset
                                    or sign in with
                                    • facebook
                                    • google
                                      Password icon
                                      I agree to the terms of service
                                      Signed in as (Sign out)
                                      You have left! (?) (thinking…)
                                      3 comments  ·  Flag idea as inappropriate…  ·  Admin →
                                    • Add delegation support in properties

                                      Please add a support for

                                      private
                                      FData: TMyDataObject
                                      public
                                      property GetSomething: Integer read FData.DataField

                                      to avoid writing a getter-method for every property

                                      7 votes
                                      Vote
                                      Sign in
                                      Check!
                                      (thinking…)
                                      Reset
                                      or sign in with
                                      • facebook
                                      • google
                                        Password icon
                                        I agree to the terms of service
                                        Signed in as (Sign out)
                                        You have left! (?) (thinking…)
                                        1 comment  ·  Flag idea as inappropriate…  ·  Admin →
                                      • swapping any 2 variables

                                        Being able to swap 2 variables by calling swap(var a,b) rather than doing:
                                        tmp:= a;
                                        a:= b;
                                        b:= tmp;

                                        Makes for easier to read code.

                                        A different name is required since "swap" is already a different procedure from original pascal, with little value today.

                                        7 votes
                                        Vote
                                        Sign in
                                        Check!
                                        (thinking…)
                                        Reset
                                        or sign in with
                                        • facebook
                                        • google
                                          Password icon
                                          I agree to the terms of service
                                          Signed in as (Sign out)
                                          You have left! (?) (thinking…)
                                          0 comments  ·  Flag idea as inappropriate…  ·  Admin →
                                        • auto initializing and finalizing records

                                          It would be useful to have records with auto initialization and finalization. With this possibility the things like C++ auto_ptr or C# TNullable are implemented with less memory consumption and more elegant than based on interface using. To reach this it's sufficent to allow parameterless constructor and destructor in record types. In the case of function/procedure the call of constructor must be emited by compiler before begin and the call of the destructor must be emited after end. If record has not parameterless constructor then compiler should consider it like usual record. The compiler should not allow destructor in records…

                                          5 votes
                                          Vote
                                          Sign in
                                          Check!
                                          (thinking…)
                                          Reset
                                          or sign in with
                                          • facebook
                                          • google
                                            Password icon
                                            I agree to the terms of service
                                            Signed in as (Sign out)
                                            You have left! (?) (thinking…)
                                            0 comments  ·  Flag idea as inappropriate…  ·  Admin →
                                          ← Previous 1
                                          • Don't see your idea?

                                          Language Features

                                          Feedback and Knowledge Base