[fpc-pascal] a proposal about "with" syntax

Flávio Etrusco flavio.etrusco at gmail.com
Sun Mar 17 15:33:18 CET 2013


On Sun, Mar 17, 2013 at 6:59 AM, Sven Barth <pascaldragon at googlemail.com> wrote:
> On 17.03.2013 06:00, Flávio Etrusco wrote:
>>
>>    type generic TAlias1<T: TObject> = class(TObject)
>>      function Alias1: T;
>>    end;
>
> This already works.

In 2.7 I assume, because it doesn't work in 2.6.2. Great anyway :)

>>   function<T: TObject> Alias1(Source: T): TAlias1<T>;
>
> I don't really get what you want to express with that...

This is a Java a construction, I don't know whether it exists in other
languages.
In Java you specify it before the result type. It means the
parameterized result is be based on the parameter it receives. You can
also "bind" several parameters:

static <T extends Comparable> int IndexOf(List<T> p_list, T p_item);

-Flávio



More information about the fpc-pascal mailing list