This Question is Assumed Answered

1 "correct" answer available (5 pts) 15 "helpful" answers available (3 pts)
1 Replies Last post: Feb 19, 2008 8:44 AM by cbarber

Curl and the meaning of the {package} herald

Feb 15, 2008 12:26 PM

Click to view rshiplett's profile MVP rshiplett 36 posts since
Oct 17, 2007
There was a time ca. Curl 1.7 when developers seemed to think that {package} was to be used to prevent circular declaration issues and such in Curl source. In that view, {package} is not much different than a main class in a Java or C# file.

But more and more it is uncommon to see any actual source in a file with a {package} herald; what one sees are {import} expressions and includes,

However the included files themselves have no heraldic metadata other than [char-encoding}

Perhaps the issue of source file metadata could be approached in terms of a herald that captures the need for the JIT to compile-at-load but not serve as the common namespace achieved by {package}

{module} comes to mind but in other languages it is synonymous with the introduction of namespaces

{parcel} and {assembly} are possibles ....

There is also a possible variant

{outer}

{inner}

which covers 'file' visibility without introducing a namespace and has something curly-brace about it ... but they tend to be used in reference to looping control.

From bookbinding comes 'codex' 'signature' 'helix' 'velo' and 'folio' among others ...

One option:

{source outer? = true} || must be the outer herald of the physical file (first item in the file at top level) for outer? to be true

{source inner? = true} || must be within a {source outer? = true} for inner? to be true

In an editor only the outer? contents might be displayed ( keeps implementation details further outa sight without being packaged up elsewhere) when you do not want to see such details

Almost all metadata would be at the outer? level when that is set to true

the default is for outer? to be false and inner? set to true is ignored unless ...

A file of equi-valence classes would have {source } entries with none being inner?

A file with a principal class (API is here) and private implementation class in the same file would have an outer? = true {source} herald

This could be very helpful when there is no packaging changes occuring but there is refactoring occurring across implementation details across files

Click to view cbarber's profile Curl cbarber 115 posts since
Sep 27, 2007
1. Re: Curl and the meaning of the {package} herald Feb 19, 2008 8:44 AM

The 'package' declaration is quite different from the main class in Java or C#. The package declaration names the package, allows the developer to specify package-wide compiler directives, set attributes that may affect the caching behavior of the package, and associate arbitrary meta-data with the compiled package instance. AFAIK, the main class in Java does not have anything comparable to this.

It is true that Curl has not provided a general capability for associating meta-data with a single source file, but before we would add such a capability I think we would want to have a better understanding of the use cases. Do you think you could provide more specific examples of what you would like to express?

Note that if you are only interested in external tool support you can always put meta-data in comments or in a user-defined macro.