Recent

Author Topic: And another question about the "record"  (Read 565 times)

beria

  • Jr. Member
  • **
  • Posts: 70
And another question about the "record"
« on: September 26, 2022, 12:06:37 pm »
Am I right to understand that using Enumerator and Initialize/Finalize for one record are mutually incompatible things, because any execution of Enumerator causes implicit and irrevocable additional procedures Finalize and Initialize, which completely kills the logic of initial initializing data in the record and removing dynamic objects inside it, when they leave the visibility area...

Thaddy

  • Hero Member
  • *****
  • Posts: 14380
  • Sensorship about opinions does not belong here.
Re: And another question about the "record"
« Reply #1 on: September 26, 2022, 01:06:20 pm »
Nonsense.
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

PascalDragon

  • Hero Member
  • *****
  • Posts: 5486
  • Compiler Developer
Re: And another question about the "record"
« Reply #2 on: September 26, 2022, 01:21:00 pm »
Am I right to understand that using Enumerator and Initialize/Finalize for one record are mutually incompatible things, because any execution of Enumerator causes implicit and irrevocable additional procedures Finalize and Initialize, which completely kills the logic of initial initializing data in the record and removing dynamic objects inside it, when they leave the visibility area...

Well, it currently is the case that there is a bug related to that combination (namely if what is returned by GetEnumetor also uses management operators), so currently it can't be suggested to use both, but in the end it is supposed to work. What should work however is if a record type that uses management operators provides a GetEnumerator.

beria

  • Jr. Member
  • **
  • Posts: 70
Re: And another question about the "record"
« Reply #3 on: September 26, 2022, 01:26:02 pm »
Am I right to understand that using Enumerator and Initialize/Finalize for one record are mutually incompatible things, because any execution of Enumerator causes implicit and irrevocable additional procedures Finalize and Initialize, which completely kills the logic of initial initializing data in the record and removing dynamic objects inside it, when they leave the visibility area...

Well, it currently is the case that there is a bug related to that combination (namely if what is returned by GetEnumetor also uses management operators), so currently it can't be suggested to use both, but in the end it is supposed to work. What should work however is if a record type that uses management operators provides a GetEnumerator.

Thank you. I figured out that it's the error FPC.... There is no information about when it was fixed. Just if not long - this part of the code I'm currently rewriting can wait a few weeks... And I really don't want to do separate types just for GetEnumerator - there are already too many of them in the code.
« Last Edit: September 26, 2022, 01:29:39 pm by beria »

PascalDragon

  • Hero Member
  • *****
  • Posts: 5486
  • Compiler Developer
Re: And another question about the "record"
« Reply #4 on: September 26, 2022, 01:45:18 pm »
Am I right to understand that using Enumerator and Initialize/Finalize for one record are mutually incompatible things, because any execution of Enumerator causes implicit and irrevocable additional procedures Finalize and Initialize, which completely kills the logic of initial initializing data in the record and removing dynamic objects inside it, when they leave the visibility area...

Well, it currently is the case that there is a bug related to that combination (namely if what is returned by GetEnumetor also uses management operators), so currently it can't be suggested to use both, but in the end it is supposed to work. What should work however is if a record type that uses management operators provides a GetEnumerator.

Thank you. I figured out that it's the error FPC.... There is no information about when it was fixed. Just if not long - this part of the code I'm currently rewriting can wait a few weeks... And I really don't want to do separate types just for GetEnumerator - there are already too many of them in the code.

I said nothing about the bug being fixed. If you look at the link you'll see that the issue is still open and from my research it might be quite involved to fix. So absolutely no timeline for that.

Arioch

  • Sr. Member
  • ****
  • Posts: 421
Re: And another question about the "record"
« Reply #5 on: September 26, 2022, 03:33:20 pm »
[don't want to do separate types just for GetEnumerator

make it interface type rather than record then ?

 

TinyPortal © 2005-2018