So, Embarcadero, Nick Hodges and Marco Cantù – it gets complicated now.

So, Embarcadero, Nick Hodges and Marco Cantù – it gets complicated now.

The full Windows APIs on ARM CPUs.

You need a single life-time model now.

Will the compiler be ARC or non-ARC this time?

Make a choice and see it through on all platforms, please.

http://www.pcworld.com/article/3191401/computers/qualcomm-first-windows-10-arm-pc-coming-in-the-fourth-quarter.html

Wish: Interface support for record/class helpers

Wish: Interface support for record/class helpers

Scenario: We are adding record helpers for all our enumerated types to reduce code clutter and enhance readability

type

TMyEnum = (A, B C);

TMyEnumHelper = record helper for TMyEnum

function ToString:string;

function Description: string;

end;

The old pattern was to create

function TMyEnumValueToString(const Value: TMyEnum):String;

function TMyEnumDescription(const Value: TMyEnum):String;

in addition to the enumerated type.

Rather than having to write

var

Code: TMyEnum;

begin

Writeln(TMyEnumValueToString(Code), ‘ ‘, TMyEnumDescription(Code));

We can now write

var

Code: TMyEnum;

begin

Writeln(Code.ToString, ‘ ‘, Code.Description);

which reads a lot better.

But – For unit testing, this creates another predicament

We have used an RTTI trick to create a loop for each value in anon.type T for enumerations, and hence had a

type

TEnumTester

type

reference to function EnumToString(const Value: T):String;

end;

But there is no such way to “genericize” a helper method.

type

IEnumHelper = interface

function ToString:string;

function Description: string;

end;

I can’t declare an interface which a record helper have to adher to, as there is no syntax to do so, and I can’t constrain the generic type to match that interface

My suggestion would be to allow something like

type

TMyEnumHelper = record helper for (TMyEnum, IEnumHelper)

function ToString:string;

function Description: string;

end;

TEnumTester = class

end;

and be able to declare

var

TestMyEnum: TEnumTester;

Today the interface constraint fails with

[dcc32 Error] : E2514 Type parameter ‘T’ must support interface ‘IEnumHelper’

since the enumerated type is not recognized as having support for the interface.

I think that would have been helpful – as would a generics constraint for enumerated types be.

Quality Portal Issue RSP-16799

https://quality.embarcadero.com/browse/RSP-16799

In the department of wishful thinking:

In the department of wishful thinking:

type

TElement = class(TSomeClass)

Sibling: TElement;

end;

type

LinkAttribute = class(TCustomAttribute)

FLink: TElement;

constructor Create(aLink:TElement);

end;

TContainer = class

X1: TElement;

[Link(X1)] //<– wish I could use an attribute to link X1 with Y1

Y1: TElement;

X2: TElement;

[Link(X2)] //<– wish I could use an attribute to link X2 with Y2

Y2: TElement;

end;

It would be nice if attributes could reference class/record local fields or properties.

I know – it would put a lot of load on the compiler / linker.

If the compiler was two pass, order would not be important.

Since the compiler is single pass – perhaps something like

TContainer = class

[Link(forward Y1)]

X1: TElement;

Y1: TElement;

[Link(forward Y2)]

X2: TElement;

Y2: TElement;

end;

could be an option as well.

#MoreDeclarationLessCode