Re: [fpc-devel] circular uses clauses

2008-10-03 Thread Graeme Geldenhuys
On Fri, Oct 3, 2008 at 2:31 AM, Joao Morais [EMAIL PROTECTED] wrote:

 Because a Pascal compiler parses the interface section of an unit only once,

That would make sense. And probably the reason why FPC and Delphi are
such fast compilers compared to C compilers.

Thanks for the info.


Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] circular uses clauses

2008-10-03 Thread Daniël Mantione



Op Fri, 3 Oct 2008, schreef Graeme Geldenhuys:


On Fri, Oct 3, 2008 at 2:31 AM, Joao Morais [EMAIL PROTECTED] wrote:


Because a Pascal compiler parses the interface section of an unit only once,


That would make sense. And probably the reason why FPC and Delphi are
such fast compilers compared to C compilers.


Yes, the interface contains all information the compiler needs to call a 
procedure. Once this is known the compiler can call procedures in a unit 
without having compiled the implementation yet. This is why 
implementations can use each other (a procedure call to a not yet compiled 
unit is no problem), but interfaces cannot (a reference to a type in a not 
yet compiled interface is problematic, because it affects how procedures 
are called).


Daniël___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] circular uses clauses

2008-10-03 Thread Marco van de Voort
In our previous episode, Graeme Geldenhuys said:
 
 Quote from CodeGear news
 circular uses clauses - why can't I declare two classes in two units
 that refer to each other? Why doesn't forward declarations cope with
 this? I've got this feature in C, C++ and C# why not Delphi?
 
 That's a good question... Why can't FPC allow that either?  I don't
 know the internals of FPC, but can't FPC simply keep a list of used
 units as it compiles, so it simply skips any later references. What is
 the technical issue?  I'm just curious here.

Why do I have to put my files in a directory hierarchy and central (GAC)
registries in C# and Java? Why can't I just throw all in one dir and let the
compiler figure it out, like in FPC ?


___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] circular uses clauses

2008-10-03 Thread Graeme Geldenhuys
On Fri, Oct 3, 2008 at 3:27 PM, Marco van de Voort [EMAIL PROTECTED] wrote:

 Why do I have to put my files in a directory hierarchy and central (GAC)
 registries in C# and Java? Why can't I just throw all in one dir and let the
 compiler figure it out, like in FPC ?

I agree!  The file names could contain the namespace with a dot
notation. FPC rules! :-)


Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] circular uses clauses

2008-10-02 Thread Graeme Geldenhuys
Hi.

Quote from CodeGear news
circular uses clauses - why can't I declare two classes in two units
that refer to each other? Why doesn't forward declarations cope with
this? I've got this feature in C, C++ and C# why not Delphi?

That's a good question... Why can't FPC allow that either?  I don't
know the internals of FPC, but can't FPC simply keep a list of used
units as it compiles, so it simply skips any later references. What is
the technical issue?  I'm just curious here.


Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] circular uses clauses

2008-10-02 Thread ik
The difference between include and uses is that include just drop
everything inside the file that is using it, uses is also adding
namespace and you do not share the same content.
The problem with circular issues, is that it really hard to debug
problems, and it usually cosing more headacks then solving problems.

That's at least the reason why I think the FPC team does not allow
such behavior (there might be additional reasons for this).

Ido
On Fri, Oct 3, 2008 at 12:52 AM, Graeme Geldenhuys
[EMAIL PROTECTED] wrote:
 Hi.

 Quote from CodeGear news
 circular uses clauses - why can't I declare two classes in two units
 that refer to each other? Why doesn't forward declarations cope with
 this? I've got this feature in C, C++ and C# why not Delphi?

 That's a good question... Why can't FPC allow that either?  I don't
 know the internals of FPC, but can't FPC simply keep a list of used
 units as it compiles, so it simply skips any later references. What is
 the technical issue?  I'm just curious here.


 Regards,
  - Graeme -


 ___
 fpGUI - a cross-platform Free Pascal GUI toolkit
 http://opensoft.homeip.net/fpgui/
 ___
 fpc-devel maillist  -  fpc-devel@lists.freepascal.org
 http://lists.freepascal.org/mailman/listinfo/fpc-devel




-- 
http://ik.homelinux.org/
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] circular uses clauses

2008-10-02 Thread Joao Morais

Graeme Geldenhuys wrote:

Hi.

Quote from CodeGear news
circular uses clauses - why can't I declare two classes in two units
that refer to each other? Why doesn't forward declarations cope with
this? I've got this feature in C, C++ and C# why not Delphi?


Because a Pascal compiler parses the interface section of an unit only 
once, ...



That's a good question... Why can't FPC allow that either?  I don't
know the internals of FPC, but can't FPC simply keep a list of used
units as it compiles, so it simply skips any later references. What is
the technical issue?  I'm just curious here.


... and the interface section of an unit need to be parsed before used 
by another one?



Regards,
  - Graeme -


--
Joao Morais
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel