Jump to content

David Heffernan

Members
  • Content Count

    3536
  • Joined

  • Last visited

  • Days Won

    175

Posts posted by David Heffernan


  1. 10 minutes ago, Kas Ob. said:

    It merely does add push REG at the begining and pop REG at the end, for rbx it is saved already in code and doesn't need this.

    Wrong. It also lets the compiler out the meta data, the unwind data, needed to restore the register in case of an exception. Read Allen's article. 


  2. 33 minutes ago, Vandrovnik said:

    I believe Anders is right.

    Class reference is just a pointer - its size is known. When you use this class as a member of another class (fChild: tChild, where tChild is a class), you cannot reference its members in properties (property x: integer read fChild.x). If fChild is a record (fChild: tChild, where tChild is a record), you can reference its members in properties, like in Anders' example (property x: integer read fChild.x).

    Not being able to do that one thing would hardly invalidate the entire enterprise. We'd still be able to use the type as procedure argument which is the main thing we are striving for. 

     

    But the whole argument is predicted on this single pass. It's no big deal to pass over each type section twice to process forward declarations. Won't make a blind bit of difference to performance. 

     

    Bottom line is that it is perfectly possible to do this if Emba wanted to. 


  3. 55 minutes ago, Anders Melander said:

    It isn't. The type and offset of the members needs to be known too:

    
    type
      TMyRecord = record
        Foo: integer;
        Bar: string;
      end;
    
      TMyClass = class
      private
        FFooBar: TMyRecord;
      public
        property Foo: integer read FFooBar.Foo;
        property Bar: string read FFooBar.Bar;
      end;

     

    If what you say were true, then class forward references would not exist.


  4. 20 minutes ago, Anders Melander said:

    You are not stuck.

    With over a million lines of code, it's an epic task to migrate. 

     

    22 minutes ago, Anders Melander said:

    This problem can be solved, with certain limitations, while still staying a one-pass compiler, but at a cost of added complexity in the compiler and longer compile time.

    I can't believe that the increase in compiler time would be significant. 

    • Like 1

  5. 53 minutes ago, Sherlock said:

    A second rate language that compiles fast as hell...at least for Windows. Now I wonder why  😉

    C# compilation is pretty darn fast. Delphi compilation for 64 bit on Windows is not exactly fast.

     

    I'm sure that a first pass to define record type layouts followed by a second pass for everything else would not be costly.

     

    This isn't going to be about compilation speedy. It's about the pain of refactoring the front end. 

    • Like 2

  6. 10 minutes ago, Anders Melander said:

    Without access to the compiler source it's hard to tell, but I'll bet there are some.
    For one, as far as I can tell, it would require forward declaration of the record and I know there are good reasons why that isn't possible.

    How would you envision forward declaration of a record method would look?

    The argument is that its a single pass compile. So make it two pass. Simples. 

    • Like 1
    • Haha 1

  7. 28 minutes ago, Bernard said:

    It would be great with all the record enhancements in the next version to be able to write

     

    tPoint2D = record;

     

      tPolar2D = record
        Radius: Double;
        azimuth: Double;
        function ToCartesian: tPoint2D;
      end;

     

      tPoint2D = record
        x: Double;
        y: Double;
        function ToPolar: tPolar2D;
      end;

     

    Thanks again for the feedback

    Bloody annoying that this can't be done

    • Like 3
×