Am 14.11.2018 um 02:05 schrieb John Doe:
On Mon, Nov 12, 2018 at 1:51 AM Sven Barth via fpc-pascal <fpc-pascal@lists.freepascal.org <mailto:fpc-pascal@lists.freepascal.org>> wrote:

    The compiler now correctly rejects such declarations with a "Type
    is not completely defined error".


Making this not work is a ridiculous removal of a feature for no logical reason that serves no benefit to anyone whatsoever. It just makes records less useful, and that's it.

Just to avoid any confusion: I am talking about a typed constant declared inside a record's declaration of the same type as the record. Constants outside a record, even inside other records work as before. Also there can't be that many libraries affected, because this only ever worked in trunk. In 3.0.x the compiler simply crashed when encountering such a constant.


I've already encountered several large libraries that are pretty massively broken by this pointless change. You're very visibly just making up arbitrary "rules" out of nowhere that certainly aren't actually defined anywhere and implementing (or de-implementing) whatever strikes your fancy on a given day.

Also:

On Sat, Nov 10, 2018 at 4:56 AM Sven Barth via fpc-pascal <fpc-pascal@lists.freepascal.org <mailto:fpc-pascal@lists.freepascal.org>> wrote:

    It's not possible to use typed constants as initializers for
    variables.


What are you talking about? Of course that's possible. People do it literally all the time.

=== code begin ===

type
  TTest = record
  public
    a: LongInt;
    b: LongInt;
  public //const
    //Default: array of TTest;// = (a: 42; b: 21);
  end;

const
  Test: TTest = (a: 42; b: 21);

var
  TestVar: TTest = Test; // <<<< this fails, because typed constants can't be used as initializers (would also be the case if Test and TestVar had any other type; only untyped constants are supported here)

=== code end ===

Regards,
Sven
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to