On Jan 21, 2008 1:05 AM, Vinzent Hoefler <[EMAIL PROTECTED]> wrote: > On Friday 18 January 2008 20:12, John Stoneham wrote: > [snip] > So, the only difference is that Ada plays it safe and complains about > ambiguities while a Pascal compiler tries to resolve the ambiguity by > itself
Perhaps that's true with regard to name resolution, but Ada's package system has a significant feature which Pascal's module system lacks: child packages. Conceptually, a child package is the same thing as a nested package: package Parent is ... package Child is ... end Child; ... end Parent; Now, the nested "Child" can be referenced outside "Parent" as "Parent.Child". This has much more to offer than simply another level (sometimes very necessary) of organization to a complex program. For example, the private part of a child package has access to it's parent's private members as well. The visibility rules are similar to those that relate to inheritance (via private, protected, and public sections). This adds a level of encapsulation that is very desirable in a complex program. Normally, child packages are not defined simply as nested packages within the parent itself (although they can be). Usually, they are defined in their own file. The dot-notation in the package declaration tells the compiler that "Child" is a child package of "Parent": package Parent.Child is ... end Parent.Child; When you have a lot of Ada programming experience, the flexibility of child packages adds enormously to program structure and design. In contrast, the single-level module system of Pascal feels very limiting (however, Ada is so much more restrictive in other areas that Pascal is overall a breath of fresh air). I think it would be fantastic if Free Pascal could add child units as a language extension (of course this would reduce portability -- although on the other hand it might make porting Ada programs easier). It's difficult trying to describe the benefits to someone who has never used them (how do you know you're missing something if you've never used it and therefore never felt a need for it?) _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal