Generics in Objective-C mode bug?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Generics in Objective-C mode bug?

Free Pascal - General mailing list
Is this a bug I should report? Knowing what I do about generics now I think the type check needs to be suspended until the type is actually specialized.


{$mode objfpc}
{$modeswitch objectivec2}

program test;

type
  generic TCocoaObject<T> = objcclass (NSObject)
    // ERROR: The type "TCocoaObject$1.T" is not supported for interaction with the Objective-C and the blocks runtime.
    m_obj: T;
    function obj: T; message 'obj';
  end;

function TCocoaObject.obj: T;
begin
  result := m_obj;
end;

begin
end.


Regards,
        Ryan Joseph

_______________________________________________
fpc-pascal maillist  -  [hidden email]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Generics in Objective-C mode bug?

Free Pascal - General mailing list
Ryan Joseph via fpc-pascal <[hidden email]> schrieb am Mo., 11. Nov. 2019, 19:21:
Is this a bug I should report? Knowing what I do about generics now I think the type check needs to be suspended until the type is actually specialized.

Generics are not considered supported with Objective Pascal types. 

Regards, 
Sven 

_______________________________________________
fpc-pascal maillist  -  [hidden email]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Generics in Objective-C mode bug?

Free Pascal - General mailing list


> On Nov 11, 2019, at 1:25 PM, Sven Barth via fpc-pascal <[hidden email]> wrote:
>
> Generics are not considered supported with Objective Pascal types.
>

There's really not any reason they shouldn't though. If you specialized with "string" for example that wouldn't be anything out of the ordinary so why does it matter if it's generic or not? Maybe Jonas has a reason I don't know about.

Regards,
        Ryan Joseph

_______________________________________________
fpc-pascal maillist  -  [hidden email]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal