Re: [fpc-pascal] Generic compiler error

2017-10-23 Thread Sven Barth via fpc-pascal
Am 23.10.2017 14:37 schrieb "Maciej Izak" :

2017-10-23 14:33 GMT+02:00 Sven Barth via fpc-pascal <
fpc-pascal@lists.freepascal.org>:

> Don't know. Only time will tell.
>

Did we have new team member? I would like to meet him! ;)


Sadly time isn't around that often. :P (and why do you assume that it's a
he? :P)

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

Re: [fpc-pascal] Generic compiler error

2017-10-23 Thread Maciej Izak
2017-10-23 14:33 GMT+02:00 Sven Barth via fpc-pascal <
fpc-pascal@lists.freepascal.org>:

> Don't know. Only time will tell.
>

Did we have new team member? I would like to meet him! ;)

-- 
Best regards,
Maciej Izak
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Generic compiler error

2017-10-23 Thread Sven Barth via fpc-pascal
Am 23.10.2017 12:55 schrieb "Marcos Douglas B. Santos" :

On Mon, Oct 23, 2017 at 6:50 AM, Sven Barth via fpc-pascal
 wrote:
> Am 23.10.2017 08:29 schrieb "Marco van de Voort" :
>
> In our previous episode, Sven Barth via fpc-pascal said:
>>
>> Type aliases are currently not supported in mode Delphi. In mode ObjFPC
>> they might work, but I'm not sure about that either...
>>
>> That said I also don't see the use of type aliases for generics...
>
> How about a simple
>
>
> type   = anotherunit.;
>
> ?
>
> That is often what I use type aliases for, aliasing code that has been
> factored out of an unit back in.
>
>
> Okay, that's an acceptable use case ^^'

So, can we have this in the next version?  :)


Don't know. Only time will tell.

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

Re: [fpc-pascal] Generic compiler error

2017-10-23 Thread Marcos Douglas B. Santos
On Mon, Oct 23, 2017 at 6:50 AM, Sven Barth via fpc-pascal
 wrote:
> Am 23.10.2017 08:29 schrieb "Marco van de Voort" :
>
> In our previous episode, Sven Barth via fpc-pascal said:
>>
>> Type aliases are currently not supported in mode Delphi. In mode ObjFPC
>> they might work, but I'm not sure about that either...
>>
>> That said I also don't see the use of type aliases for generics...
>
> How about a simple
>
>
> type   = anotherunit.;
>
> ?
>
> That is often what I use type aliases for, aliasing code that has been
> factored out of an unit back in.
>
>
> Okay, that's an acceptable use case ^^'

So, can we have this in the next version?  :)

Best regards,
Marcos Douglas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Generic compiler error

2017-10-23 Thread Marcos Douglas B. Santos
On Sun, Oct 22, 2017 at 11:53 PM, Ryan Joseph
 wrote:
>
>
>> On Oct 23, 2017, at 9:14 AM, Marcos Douglas B. Santos  
>> wrote:
>>
>> How do the same with generic classes, using mode delphi?
>
> I think you need to specialize then alias the specialize type. Why do you 
> want to make an alias for an untyped generic anyways?

As Marco showed, to do this:

type   = anotherunit.;

Best regards,
Marcos Douglas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Generic compiler error

2017-10-23 Thread Marcos Douglas B. Santos
On Mon, Oct 23, 2017 at 3:28 AM, Marco van de Voort  wrote:
> In our previous episode, Sven Barth via fpc-pascal said:
>>
>> Type aliases are currently not supported in mode Delphi. In mode ObjFPC
>> they might work, but I'm not sure about that either...
>>
>> That said I also don't see the use of type aliases for generics...
>
> How about a simple
>
>
> type   = anotherunit.;
>
> ?
>
> That is often what I use type aliases for, aliasing code that has been
> factored out of an unit back in.

+1
That is I am talking about. Thanks.

Best regards,
Marcos Douglas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Generic compiler error

2017-10-23 Thread Sven Barth via fpc-pascal
Am 23.10.2017 08:29 schrieb "Marco van de Voort" :

In our previous episode, Sven Barth via fpc-pascal said:
>
> Type aliases are currently not supported in mode Delphi. In mode ObjFPC
> they might work, but I'm not sure about that either...
>
> That said I also don't see the use of type aliases for generics...

How about a simple


type   = anotherunit.;

?

That is often what I use type aliases for, aliasing code that has been
factored out of an unit back in.


Okay, that's an acceptable use case ^^'

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

Re: [fpc-pascal] Generic compiler error

2017-10-22 Thread Marco van de Voort
In our previous episode, Sven Barth via fpc-pascal said:
> 
> Type aliases are currently not supported in mode Delphi. In mode ObjFPC
> they might work, but I'm not sure about that either...
> 
> That said I also don't see the use of type aliases for generics...

How about a simple


type   = anotherunit.; 

?

That is often what I use type aliases for, aliasing code that has been
factored out of an unit back in.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Generic compiler error

2017-10-22 Thread Sven Barth via fpc-pascal
Am 23.10.2017 04:14 schrieb "Marcos Douglas B. Santos" :

Hi,

In Pascal we can do this:

type
  TXStream = TStream;

Now, TXStream is just an alias to TStream.

How do the same with generic classes, using mode delphi?

  TBar = TFoo;



Type aliases are currently not supported in mode Delphi. In mode ObjFPC
they might work, but I'm not sure about that either...

That said I also don't see the use of type aliases for generics...

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

Re: [fpc-pascal] Generic compiler error

2017-10-22 Thread Ryan Joseph


> On Oct 23, 2017, at 9:14 AM, Marcos Douglas B. Santos  
> wrote:
> 
> How do the same with generic classes, using mode delphi?

I think you need to specialize then alias the specialize type. Why do you want 
to make an alias for an untyped generic anyways?


Regards,
Ryan Joseph

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[fpc-pascal] Generic compiler error

2017-10-22 Thread Marcos Douglas B. Santos
Hi,

In Pascal we can do this:

type
  TXStream = TStream;

Now, TXStream is just an alias to TStream.

How do the same with generic classes, using mode delphi?

  TBar = TFoo;

Compile Project, Target: C:\temp\project1.exe: Exit code 1, Errors: 4
project1.lpr(25,18) Error: Identifier not found "T"
project1.lpr(25,19) Error: Type identifier expected
project1.lpr(25,20) Error: Error in type definition
project1.lpr(27,1) Error: This type cannot be a generic

My ENV is:
Lazarus 1.9.0 r56056M
FPC 3.1.1 r37505
i386-win32-win32/win64


Please, see an example below:

=== BEGIN ===

program Project1;

{$mode delphi}

uses
  Classes;

type
  IFoo = interface
  ['{5CA4AEC4-3875-4639-9975-AC2C201E0A98}']
function Value: T;
  end;

  TFoo = class(TInterfacedObject, IFoo)
  private
FValue: T;
  public
constructor Create(Value: T);
class function New(Value: T): IFoo;
function Value: T;
  end;

  TXStream = TStream;  //  OK

  TBar = TFoo; //  how solve this?

constructor TFoo.Create(Value: T);
begin
  inherited Create;
  FValue := Value;
end;

class function TFoo.New(Value: T): IFoo;
begin
  Result := Create(Value);
end;

function TFoo.Value: T;
begin
  Result := FValue;
end;

begin
  Writeln(TFoo.New(1).Value);
  Readln;
end.

=== END ===
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal