Lazarus

Programming => General => Topic started by: SlightlyOutOfPhase on June 15, 2018, 08:09:28 pm

Title: Why does the TypeInfo intrinsic return a typeless pointer instead of PTypeInfo?
Post by: SlightlyOutOfPhase on June 15, 2018, 08:09:28 pm
To me this makes no sense... the TypeInfo method is defined in the System unit, so you can technically call it without including the TypInfo unit, but it's completely useless by itself because you have to typecast it to PTypeInfo which does require including TypInfo. Anyone know the reasoning behind this?
Title: Re: Why does the TypeInfo intrinsic return a typeless pointer instead of PTypeInfo?
Post by: howardpc on June 15, 2018, 10:08:05 pm
The "reasoning" may simply be for Delphi compatibility.
Title: Re: Why does the TypeInfo intrinsic return a typeless pointer instead of PTypeInfo?
Post by: taazz on June 15, 2018, 10:36:10 pm
because ptypeinfo is declared in the typinfo unit which is compiler specific and for that reason can not be allowed to polute the system unit which should be as agnostic as possible.
Title: Re: Why does the TypeInfo intrinsic return a typeless pointer instead of PTypeInfo?
Post by: dredd on June 16, 2018, 08:03:04 am
why should it make sense? let it be and go ahead