Sign in Join

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

Mailing lists / fpc-pascal / 2012-11

Complex circular references

7 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

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

denisgolovan

Hi all

Now and again, I am trying to debug complex circular references. By complex circular references I mean those which are produced by cyclic graphs of units, not simple one unit uses another and that uses the first one.

Unfortunately, currently fpc just shows that some circular references exist between units. I wonder, is it possible to receive some more detailed information on those graphs?

Regards, Denis Golovan

Reply by email

Peter
to denisgolovan

PasDoc can produce 'dot' files of unit dependencies. (No idea if it will handle circular refs though). GraphViz can then be used to produce images based on the 'dot' files. I gave up with it because it did not parse the implementaion sections, but you won't be needing that for unit dependences. (I was hoping for a full class heirachy diagram).

http://pasdoc.sipsolutions.net/

Regards,
Peter

denisgolovan wrote 15 lines
Hi all Now and again, I am trying to debug complex circular references. By complex circular references I mean those which are produced by cyclic graphs of units, not simple one unit uses another and that uses the first one. Unfortunately, currently fpc just shows that some circular references exist between units. I wonder, is it possible to receive some more detailed information on those graphs? -- Regards, Denis Golovan _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email

denisgolovan
Show quoted text 10 lines
PasDoc can produce 'dot' files of unit dependencies. (No idea if it will handle circular refs though). GraphViz can then be used to produce images based on the 'dot' files. I gave up with it because it did not parse the implementaion sections, but you won't be needing that for unit dependences. (I was hoping for a full class heirachy diagram). http://pasdoc.sipsolutions.net/ Regards, Peter

Hm.
Dot files should the ideal solution.
Thanks a lot for the hint.

Regards, Denis Golovan

Reply by email

Jorge Aldo G. de F. Junior
to denisgolovan

I still dont understand why FPC doesnt support circular references...

There is no way to solve that ?

2012/11/22 denisgolovan :

Show quoted text 21 lines
> PasDoc can produce 'dot' files of unit dependencies. (No idea if it will > handle circular refs though). GraphViz can then be used to produce > images based on the 'dot' files. I gave up with it because it did not > parse the implementaion sections, but you won't be needing that for unit > dependences. (I was hoping for a full class heirachy diagram). > > http://pasdoc.sipsolutions.net/ > > Regards, > Peter Hm. Dot files should the ideal solution. Thanks a lot for the hint. -- Regards, Denis Golovan _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email

leledumbo
to Jorge Aldo G. de F. Junior
I still dont understand why FPC doesnt support circular references...

There is no way to solve that ?

Do you think Delphi or Turbo Pascal or even UCSD Pascal ever supports? The concept of units and uses clause makes the order in which units must be initialized (and how identifier is searched) is important, which is derived from how it's written in the uses clause, in a cascaded fashion. Thus, a uses clause serves as a depth first search path for the compiler to determine unit initialization order. If A uses B and B uses A, directly or indirectly, which one should be initialized first?

The only way to solve is to correctly group things in a unit (after all, unit serves as a placeholder for closely related things), or use 3rd unit for data sharing or the worst, use circular reference in implementation section. You'll notice that this is a common problem in a language with similar concept (and each have its own workaround).

View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Re-fpc-pascal-Complex-circular-references-tp5712061p5712073.html Sent from the Free Pascal - General mailing list .

Reply by email

Jorge Aldo G. de F. Junior
to leledumbo

Or, if the problem is the initialization, makes so that you can only have circular references among units that dont have explicit initialization/finalization.

Problem solved.

IIRC someone was trying to change FPC in order to solve circular references, but this never materialized...

2012/11/23 leledumbo :

Show quoted text 26 lines
> I still dont understand why FPC doesnt support circular references... There is no way to solve that ? Do you think Delphi or Turbo Pascal or even UCSD Pascal ever supports? The concept of units and uses clause makes the order in which units must be initialized (and how identifier is searched) is important, which is derived from how it's written in the uses clause, in a cascaded fashion. Thus, a uses clause serves as a depth first search path for the compiler to determine unit initialization order. If A uses B and B uses A, directly or indirectly, which one should be initialized first? The only way to solve is to correctly group things in a unit (after all, unit serves as a placeholder for closely related things), or use 3rd unit for data sharing or the worst, use circular reference in implementation section. You'll notice that this is a common problem in a language with similar concept (and each have its own workaround). -- View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Re-fpc-pascal-Complex-circular-references-tp5712061p5712073.html Sent from the Free Pascal - General mailing list . _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email

Noah Silva
to denisgolovan: Hi all Now and again, I am trying to debug complex circular references. By complex…

Hi.

I also wrote something that makes dot files for graphvis, and it does look at the implementation and interface sections. Search for pasviz.

Thank you,
Noah silva
2012/11/23 0:18 "denisgolovan" :

Show quoted text 19 lines
Hi all Now and again, I am trying to debug complex circular references. By complex circular references I mean those which are produced by cyclic graphs of units, not simple one unit uses another and that uses the first one. Unfortunately, currently fpc just shows that some circular references exist between units. I wonder, is it possible to receive some more detailed information on those graphs? -- Regards, Denis Golovan _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email