Hi,


I haven't used type helpers but why not change to defines like

type
  jObjectRec = record end;
  jObject= ^jObjectRec;
  jClassRec = record end;
  jClass = ^jClassRec;

or possibly simpler you could try
  jclass = type(jobject); // I believe this forces a new type and is not just an alias


that looks better.

Who can  change them? These jobject/jclass type definitions are part of fpc...





Although type is weird

type a = type (pointer);
type b = type (a);

does not compile, duplicate identifier a

type a = type (pointer);
type b = type a;

compiles, but a type helper for cannot use self as pointer. self <> nil => operator is not overloaded. But you can do writeln(self);

type a = type pointer;
type b = type (a);

does not compile, duplicate identifier a

type a = type pointer;
type b = type a;

compiles, and is like a pointer, but unlike case 2, you cannot do writeln(self) in the type helper


type a = type (pointer);
type b = type (pointer);

does not compile, duplicate identifier

type a = type (pointer);
type b = type pointer;

does not compile, error in type definition

type a = type pointer;
type b = type (pointer);

compiles

type a = type pointer;
type b = type pointer;

compiles




Cheers,
Benito



Am 23.08.2018 um 04:23 schrieb Andrew Haines via fpc-pascal:



On 08/12/2018 07:42 AM, Benito van der Zander wrote:


But this does not work, because fpc thinks jclass and jobject are the same type, so there is only one type helper for both of the types allowed.

Because it is declared as

type
     jobject=pointer;
     jclass=jobject;


What can we do about this?

I haven't used type helpers but why not change to defines like

type
  jObjectRec = record end;
  jObject= ^jObjectRec;
  jClassRec = record end;
  jClass = ^jClassRec;

or possibly simpler you could try
  jclass = type(jobject); // I believe this forces a new type and is not just an alias

Regards,

Andrew



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

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

Reply via email to