Recent

Author Topic: Why does the TypeInfo intrinsic return a typeless pointer instead of PTypeInfo?  (Read 1501 times)

SlightlyOutOfPhase

  • New member
  • *
  • Posts: 33
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?

howardpc

  • Hero Member
  • *****
  • Posts: 3067
The "reasoning" may simply be for Delphi compatibility.

taazz

  • Hero Member
  • *****
  • Posts: 5363
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.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

dredd

  • New member
  • *
  • Posts: 5
why should it make sense? let it be and go ahead
burp!