Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2019-11

Generics in Objective-C mode bug?

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Ryan Joseph

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

Reply by email

Sven Barth
to Ryan Joseph

Ryan Joseph via fpc-pascal 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

Reply by email

Ryan Joseph
to Sven Barth
On Nov 11, 2019, at 1:25 PM, Sven Barth via fpc-pascal 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

Reply by email